[SR-13858] Wrong warning message when a struct contains an uninhabited type. #56256
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
diagnostics QoI
Bug: Diagnostics Quality of Implementation
type checker
Area → compiler: Semantic analysis
Attachment: Download
Environment
I am running on Big Sur using:
Apple Swift version 5.3.1 (swiftlang-1200.0.39 clang-1200.0.32.6)
Target: x86_64-apple-darwin20.1.0
Additional Detail from JIRA
md5: 004e810d6f7df35f39c66f756c61efbc
Issue Description:
To summarize:
I create an empty enum (no case), and put it inside a struct
I define a method on the struct that calls another method on the enum
The compiler complains that the function will not be executed, which is…acceptable?
but explains that the callee is never-returning, which is kind of misleading.
I cannot get this bug reporter editor to put formatted code so I put it on a gist. I have put the Swift compiler output at the end.
Notice that for function g, which takes a value of the empty enum type, it does explain correctly, saying that the value is uninhabited.
The code is also attached.
The text was updated successfully, but these errors were encountered: