mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Instead of failing constraint generation by returning `nullptr` for an `ErrorExpr` or returning a null type when a type fails to be resolved, return a fresh type variable. This allows the constraint solver to continue further and produce more meaningful diagnostics. Most importantly, it allows us to produce a solution where previously constraint generation for a syntactic element had failed, which is required to type check multi-statement closures in result builders inside the constraint system.
14 lines
389 B
Swift
14 lines
389 B
Swift
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -typecheck -verify
|
|
|
|
// REQUIRES: objc_interop
|
|
|
|
import Foundation
|
|
|
|
class MyClass: NSObject {
|
|
func f() {
|
|
let url = URL(url) // expected-error{{use of local variable 'url' before its declaration}}
|
|
// expected-note@-1 {{'url' declared here}}
|
|
// expected-error@-2 {{missing argument label 'string:' in call}}
|
|
}
|
|
}
|