mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Avoid a re-typecheck in `diagnoseContextualConversionError` if the expression type is already known and only return `true` if we know that at least one error diagnostic has been emitted otherwise there is a risk that type-check is going to return without any and fail in verifier. Resolves: rdar://problem/40002266
12 lines
373 B
Swift
12 lines
373 B
Swift
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify %s
|
|
// REQUIRES: objc_interop
|
|
|
|
import Foundation
|
|
|
|
struct S {
|
|
init<T: NSNumber>(_ num: T) {
|
|
self.init(num != 0) // expected-error {{binary operator '!=' cannot be applied to operands of type 'T' and 'Int'}}
|
|
// expected-note@-1 {{expected an argument list of type '(Int, Int)'}}
|
|
}
|
|
}
|