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

Bad diagnostic for any P! #72662

Open
AnthonyLatsis opened this issue Mar 28, 2024 · 3 comments
Open

Bad diagnostic for any P! #72662

AnthonyLatsis opened this issue Mar 28, 2024 · 3 comments
Assignees
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 existentials Feature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased values good first issue Good for newcomers implicitly unwrapped optionals Feature → types: Implicitly unwrapped optional types, aka IUO swift 6.0 type checker Area → compiler: Semantic analysis TypeResolver types Feature: types unexpected behavior Bug: Unexpected behavior or incorrect output

Comments

@AnthonyLatsis
Copy link
Collaborator

AnthonyLatsis commented Mar 28, 2024

Description

No response

Reproduction

protocol P {}

// error: using '!' is not allowed here; perhaps '?' was intended? [implicitly_unwrapped_optional_in_illegal_position]
// error: optional 'any' type must be written '(any P2)?' [incorrect_optional_any]
let _: any P!

Expected behavior

A single error, optional 'any' type must be written '(any P)!', as in the case of let _: any P?.

Environment

Swift version 6.0-dev (LLVM 48dc0c6fa01ce9e, Swift 19fbe5b)
Target: x86_64-apple-macosx14.0

Additional information

This good first issue Good for newcomers will suit an experienced Swift user.

@AnthonyLatsis AnthonyLatsis added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself good first issue Good for newcomers diagnostics QoI Bug: Diagnostics Quality of Implementation type checker Area → compiler: Semantic analysis TypeResolver existentials Feature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased values unexpected behavior Bug: Unexpected behavior or incorrect output types Feature: types swift 6.0 implicitly unwrapped optionals Feature → types: Implicitly unwrapped optional types, aka IUO labels Mar 28, 2024
@CrazyFanFan
Copy link
Contributor

@AnthonyLatsis Would modifying PrintOptions::forDiagnosticArguments() be the correct solution to this problem? If so, I believe I could attempt to resolve it.

@AnthonyLatsis
Copy link
Collaborator Author

No, this is a problem with the diagnosis of invalid code, not the format used to print diagnostic messages.

@fabricerenard12
Copy link

fabricerenard12 commented Apr 3, 2024

Hi AnthonyLatsis, if no one is already addressing this issue, I would love to start working on it. Could you please assign it to me?

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 existentials Feature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased values good first issue Good for newcomers implicitly unwrapped optionals Feature → types: Implicitly unwrapped optional types, aka IUO swift 6.0 type checker Area → compiler: Semantic analysis TypeResolver types Feature: types unexpected behavior Bug: Unexpected behavior or incorrect output
Projects
None yet
Development

No branches or pull requests

3 participants