[SR-6677] Compiler error is unhelpful when incorrect type passed to argument that uses associated type in generic function #49226
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
Xcode 9.2 GM.
Additional Detail from JIRA
md5: 4bfd3c5445482a453c99c526b44b5b23
Issue Description:
See attached code. If you use a generic function with a type T that has an associated type U, and the function uses T.U as an argument type, passing the wrong type for that argument yields confusing errors.
Given a function declared something like:
If you pass the wrong type of value for
state
you get errors of the form:...where you would hope it would say something like "argument `with` expects a value of type X, but is passed a String".
The attached playground demonstrates this senario in isolation, about 40 lines.
The text was updated successfully, but these errors were encountered: