mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
There was a diagnostic to catch these, but it wasn't triggered reliably, and it sounds like users were already relying on this feature working in the few cases where it did. So instead, just map an archetype's superclass into context when building the archetype. Recursion is still not allowed and is diagnosed, for example <T, U where T : C<U>, U : C<T>>. Note that compiler_crashers_fixed/00022-no-stacktrace.swift no longer produces a diagnostic in Sema, despite the fact that the code is invalid. It does diagnose in IRGen when we map the type into context. Diagnosing in Sema requires fixing the declaration checker to correctly handle recursion through a generic signature. Right now, if recursion is detected, we bail out, but do not always diagnose. Alternatively, we could prohibit unbound generic types from appearing in generic signatures. This is a more principled fix for rdar://problem/24590570.
10 lines
354 B
Swift
10 lines
354 B
Swift
// RUN: %target-swift-frontend %s -parse
|
|
|
|
// Distributed under the terms of the MIT license
|
|
// Test case submitted to project by https://github.com/practicalswift (practicalswift)
|
|
// Based on the stack trace this bug is actually triggering a different code path
|
|
// compared to case #021. so these appears not to be dupes(!).
|
|
|
|
class A<T where T : A> {
|
|
}
|