mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This commit changes how we represent caller-side default arguments within the AST. Instead of directly inserting them into the call-site, use a DefaultArgumentExpr to refer to them indirectly. The main goal of this change is to make it such that the expression type-checker no longer cares about the difference between caller-side and callee-side default arguments. In particular, it no longer cares about whether a caller-side default argument is well-formed when type-checking an apply. This is important because any conversions introduced by the default argument shouldn't affect the score of the resulting solution. Instead, caller-side defaults are now lazily type-checked when we want to emit them in SILGen. This is done through introducing a request, and adjusting the logic in SILGen to be more lenient with ErrorExprs. Caller-side defaults in primary files are still also currently checked as a part of the declaration by `checkDefaultArguments`. Resolves SR-11085. Resolves rdar://problem/56144412.
6 lines
110 B
Swift
6 lines
110 B
Swift
// RUN: not %target-swift-frontend -typecheck %s
|
|
|
|
func foo(x: Int) {}
|
|
func foo(line: String = #line) {}
|
|
foo()
|