mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +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.
7 lines
205 B
Swift
7 lines
205 B
Swift
// RUN: %target-swift-frontend -emit-sil -verify -module-name main -primary-file %s %S/Inputs/invalid-magic-literals-other.swift
|
|
|
|
func bar() {
|
|
badMagicLiteral()
|
|
let _: Int = badGenericMagicLiteral()
|
|
}
|