mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Syntactically verify that initializer expressions of '@const' variables and argument expressions to '@const' parameters consist strictly of syntactically-verifiable set of basic values and operations
12 lines
645 B
Swift
12 lines
645 B
Swift
// Constant globals referencing other constant globals and forming a cycle
|
|
// REQUIRES: swift_feature_CompileTimeValues
|
|
// REQUIRES: swift_feature_CompileTimeValuesPreview
|
|
// REQUIRES: rdar146957382
|
|
// RUN: %target-swift-frontend -emit-ir -primary-file %s -parse-as-library -verify -enable-experimental-feature CompileTimeValues -enable-experimental-feature CompileTimeValuesPreview
|
|
// RUN: %target-swift-frontend -emit-ir -primary-file %s -parse-as-library -verify -enable-experimental-feature CompileTimeValues
|
|
|
|
@const let a: Int = c
|
|
@const let b: Int = a
|
|
@const let c: Int = b
|
|
// expected-error@-1 {{cycle in definitions of constant values}}
|