Files
swift-mirror/test/Constraints/rdar40002266.swift
Pavel Yaskevich 934351a8e3 [Diagnostics] Hint contextual type diagnostics with expression type if known
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
2018-05-12 13:56:53 -07:00

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