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-12896] Improve diagnostic for opaque types + property/method access #55342

Open
typesanitizer opened this issue May 28, 2020 · 1 comment

Comments

@typesanitizer
Copy link

typesanitizer commented May 28, 2020

Previous ID SR-12896
Radar rdar://problem/63709798
Original Reporter @typesanitizer
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: c1363e1550ed3adb46c183f42540396e

Issue Description:

Forum post: https://forums.swift.org/t/possible-compiler-bug-with-opaque-types-or-is-this-intended-behavior/36946

The user ends up getting a diagnostic

// error: Combine Lab - Solutions.xcplaygroundpage:16:32: error: value of type '(some Publisher).Output' has no member 'bitWidth'

This is not great because the point is not that the member isn't present, the point is that you can't access knowledge about the member here. It's not a "the compiler can't do this" (it very well could), it's a "allowing this violates the language model" (barring future extensions).

I don't have a solid idea for what the new diagnostic should be. Here are some things that need to be made clear:

1. If Output had a protocol constraint for P, you could use those witnesses.
2. For every other property/method etc, you cannot use it, even if the concrete type is known. However, if the concrete type is known, perhaps we should consider offering a fix-it for exposing the concrete type in the function's signature?

@typesanitizer
Copy link
Author

typesanitizer commented May 28, 2020

@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
Projects
None yet
Development

No branches or pull requests

1 participant