Files
swift-mirror/test/Constraints/rdar45511837.swift
Pavel Yaskevich 290bd0425c [CSDiag] Fix crash related to failures in contextual type requirements
If failed constraint mentions member declaration which is not
generic, it means that generic requirements came from context
and should not be diagnosed by `diagnoseUnresolvedDotExprTypeRequirementFailure`.

Resolved: rdar://problem/45511837
2018-10-24 18:20:15 -07:00

24 lines
502 B
Swift

// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify %s
// REQUIRES: objc_interop
import Foundation
protocol A: RawRepresentable {}
extension A {
static func +(lhs: RawValue, rhs: Self) -> Self {
fatalError()
}
}
class Foo<Bar: NSObject> {
var foobar: Bar {
fatalError()
}
lazy var foo: () -> Void = {
// TODO: improve diagnostic message
_ = self.foobar + nil // expected-error {{'Foo<Bar>' requires that 'Bar' inherit from 'NSObject'}}
}
}