-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of Implementationtype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis
Description
Previous ID | SR-5020 |
Radar | None |
Original Reporter | @milseman |
Type | Bug |
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug, DiagnosticsQoI, TypeChecker |
Assignee | None |
Priority | Medium |
md5: cbeac3c4000ef8cf021562391607daed
Issue Description:
Trying to compile something like:
struct S<T> { static var desc: String { return "hello" } }
print(S.desc)
Gives the not-so-helpful error message:
error: repl.swift:2:9: error: argument type 'String' does not conform to expected type 'Any'
print(S.desc)
~~^~~~
as Any
The solution is to explicitly provide the type:
print(S<Any>.desc)
It would be nice to get a more targeted error message here, and maybe even a fixit.
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of Implementationtype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis