mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
23 lines
470 B
Swift
23 lines
470 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
class C : Hashable {
|
|
var x = 0
|
|
|
|
func hash(into hasher: inout Hasher) {
|
|
hasher.combine(x)
|
|
}
|
|
}
|
|
|
|
func == (x: C, y: C) -> Bool { return true }
|
|
|
|
|
|
class D : C {}
|
|
|
|
var setC = Set<C>()
|
|
var setD = Set<D>()
|
|
|
|
// Test set upcasts
|
|
setC = setD
|
|
setD = setC // expected-error{{cannot assign value of type 'Set<C>' to type 'Set<D>'}}
|
|
// expected-note@-1 {{arguments to generic parameter 'Element' ('C' and 'D') are expected to be equal}}
|