Files
swift-mirror/test/ConstValues/FloatintPointLiterals.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

13 lines
656 B
Swift

// Constant globals on simple floating-point literals
// 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 = 42.0
@const let constGlobal2: Double = 42.0
@const let constGlobal3: Float = 42.0
// TODO: Restrict to platforms where this is available
//@const let constGlobal4: Float16 = 42.0