Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0180-rdar45557325.swift
Alex Hoppen e14fa7291f [CS] Don’t fail constraint generation for ErrorExpr or if type fails to resolve
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.
2022-07-20 09:46:12 +02:00

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}}
}
}