Files
swift-mirror/test/ConstValues/Tuples.swift
T
Artem Chikin 0bbd35242c [Literal Expressions] Add support for simple constant-folded literal expressions
This change adds an experimental feature 'LiteralExpressions` which allows for use of simple binary expressions of integer type composed of literal value operands.

For now, such literal expressions are only supported in initializers of '@section` values.
2026-02-09 11:35:45 +00:00

15 lines
899 B
Swift

// Constant globals on tuples
// 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 -verify
@const let constGlobal1: Int = 42
@const let constGlobal2: (Int, Int) = (42, 42)
@const let constGlobal3: (Int, Bool) = (42, true)
@const let constGlobal4: (Int, (Int, Int)) = (42, (42, 42))
@const let constGlobal5: (Int, Float) = (42, 42.0)
// Closure call not supported in syntactically-validated mode
@const let constGlobal7: (UInt64, StaticString, @convention(c) ()->Int) = (42, "hi", { return 42 }) // expected-error {{not supported in a literal expression}}