mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
In many places, we're interested in whether a type with archetypes *might be* a superclass of another type with the right bindings, particularly in the optimizer. Provide a separate Type::isBindableToSuperclassOf method that performs this check. Use it in the devirtualizer to fix rdar://problem/24993618. Using it might unblock other places where the optimizer is conservative, but we can fix those separately.
12 lines
169 B
Swift
12 lines
169 B
Swift
// RUN: %target-swift-frontend -parse -verify %s
|
|
|
|
protocol P {}
|
|
|
|
class GenericBase<T>: P {}
|
|
|
|
class Derived: GenericBase<Int> {}
|
|
|
|
func foo<T: P>(x: T) {}
|
|
|
|
foo(Derived())
|