mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Untyped throws depends on existentials (`any Error`), and is therefore not available in Embedded Swift. Introduce a diagnostic that diagnoses any use of untyped throws, suggesting that one use typed throws instead. Make this an opt-in diagnostic enabled with `-Wwarning EmbeddedRestrictions`, whether in Embedded Swift or not, using the "default ignore" flag on these new warnings. Document this new diagnostic group, and put the existing Embedded Swift error about weak/unowned references in it as well. Part of the general push to have the type checker identify code that will not compile as Embedded Swift earlier, rdar://133874555.
17 lines
588 B
Swift
17 lines
588 B
Swift
// RUN: %target-swift-emit-ir %s -wmo
|
|
// RUN: %target-swift-emit-ir %s -enable-experimental-feature Embedded -verify
|
|
|
|
// REQUIRES: swift_in_compiler
|
|
// REQUIRES: optimized_stdlib
|
|
// REQUIRES: OS=macosx || OS=linux-gnu
|
|
// REQUIRES: swift_feature_Embedded
|
|
|
|
public class MyClass { }
|
|
|
|
public struct MyStruct {
|
|
var normalVar: MyClass
|
|
weak var weakVar: MyClass? // expected-error {{attribute 'weak' cannot be used in Embedded Swift}}
|
|
unowned var unownedVar: MyClass // expected-error {{attribute 'unowned' cannot be used in Embedded Swift}}
|
|
unowned(unsafe) var unownedUnsafe: MyClass
|
|
}
|