mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This loop in the constraint solver won't terminate when given ill-formed code involving circular inheritance. Make it terminate. Fixes rdar://problem/54296278.
9 lines
311 B
Swift
9 lines
311 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
// rdar://problem/54296278 - infinite loop
|
|
class Foo {}
|
|
class Bar: Bar {} // expected-error{{'Bar' inherits from itself}}
|
|
func foo(_ o: AnyObject) -> Foo? {
|
|
return o as? Bar // expected-error{{cannot convert return expression of type 'Bar?' to return type 'Foo?'}}
|
|
}
|