Files
swift-mirror/test/ConstValues/IntegerArithmetic.swift
Artem Chikin d8176a7e89 [Compile Time Values] Add syntactic verification of valid expressions in '@const' contexts
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
2025-05-20 09:38:36 -07:00

14 lines
713 B
Swift

// Constant globals on integer arithmetics
// REQUIRES: swift_feature_CompileTimeValues
// REQUIRES: swift_feature_CompileTimeValuesPreview
// RUN: %target-swift-frontend -emit-ir -primary-file %s -parse-as-library -enable-experimental-feature CompileTimeValues -enable-experimental-feature CompileTimeValuesPreview
// RUN: %target-swift-frontend -emit-ir -primary-file %s -parse-as-library -enable-experimental-feature CompileTimeValues
@const let constGlobal1: Int = 42
@const let constGlobal2: UInt = 42 + 42
@const let constGlobal3: UInt = 42 * 42
@const let constGlobal4: UInt = 42 - 42
@const let constGlobal5: UInt = 42 / 42
@const let constGlobal6: UInt = 42 % 2
@const let constGlobal7: UInt = (42 % 2)