mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Put in some rudimentary logic for finding circular references within the iterative type checker and diagnosing those cycles. The "rudimentary" part is because we're performing linear searches within a stack rather than keeping a proper dependency graph, which is inefficient and could display longer cycles than are actually present. Additionally, the diagnostic is not specialized to the actual query, so we get a generic "circular reference" diagnostic. OTOH, we show all of the declarations involved in the cycle, which at least lets the user figure out where the cycle occurred. Enable the iterative type checker for resolving the type of a global typealiases. Swift SVN r32572
26 lines
613 B
Swift
26 lines
613 B
Swift
// RUN: %target-parse-verify-swift
|
|
|
|
class Foo {
|
|
func bar(_: bar) {} // expected-error{{use of undeclared type 'bar'}}
|
|
}
|
|
|
|
class C {
|
|
var triangle : triangle // expected-error {{'triangle' used within its own type}} expected-error{{use of undeclared type 'triangle'}}
|
|
|
|
init() {}
|
|
}
|
|
|
|
typealias t = t // expected-error {{circular reference}}
|
|
|
|
|
|
|
|
|
|
// <rdar://problem/17564699> QoI: Structs should get convenience initializers
|
|
struct MyStruct {
|
|
init(k: Int) {
|
|
}
|
|
convenience init() { // expected-error {{delegating initializers in structs are not marked with 'convenience'}} {{3-15=}}
|
|
self.init(k: 1)
|
|
}
|
|
}
|