Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-13858] Wrong warning message when a struct contains an uninhabited type. #56256

Open
swift-ci opened this issue Nov 16, 2020 · 1 comment
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

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-13858
Radar rdar://problem/71447057
Original Reporter minsheng (JIRA User)
Type Bug

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
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI, TypeChecker
Assignee None
Priority Medium

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.

@typesanitizer
Copy link

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

2 participants