You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently type-check this by transforming the argument list into a tuple, and coercing it to the destination tuple type. This works fine for regular compilation, however for interface generation it means we end up with ("", "") instead of (String, String)("", "") if written as e.g a default argument.
Ideally we'd preserve the full expression, probably by introducing an AST node to represent this conversion in type-checked AST. This is especially important for cases where the destination tuple type is required for the expression to be re-type-checked properly, e.g (Substring, Substring)("", "") or (Int?, Int?)(nil, nil).
I'm not sure if this has compatibility implications, as e.g a function with a default argument:
publicfuncfoo(arg: Any = (Substring, Substring)("", "")) {}
is currently being exposed to clients as:
publicfuncfoo(arg: Any = ("", ""))
so adding back the missing type information may change how it is type-checked.
The text was updated successfully, but these errors were encountered:
Additional Detail from JIRA
md5: 95b86d530d86dd2a243c84a8d6b97f65
Issue Description:
For a tuple construction expr such as:
(yes, this is legal Swift!)
We currently type-check this by transforming the argument list into a tuple, and coercing it to the destination tuple type. This works fine for regular compilation, however for interface generation it means we end up with ("", "") instead of (String, String)("", "") if written as e.g a default argument.
Ideally we'd preserve the full expression, probably by introducing an AST node to represent this conversion in type-checked AST. This is especially important for cases where the destination tuple type is required for the expression to be re-type-checked properly, e.g (Substring, Substring)("", "") or (Int?, Int?)(nil, nil).
I'm not sure if this has compatibility implications, as e.g a function with a default argument:
is currently being exposed to clients as:
so adding back the missing type information may change how it is type-checked.
The text was updated successfully, but these errors were encountered: