Files
swift-mirror/test/ConstValues/IntegerBinaryExpressions.swift
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
744 B
Swift

// Constant globals on simple integer literals
// REQUIRES: swift_feature_CompileTimeValues
// REQUIRES: swift_feature_CompileTimeValuesPreview
// 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 constGlobal1: Int = 42 + 1
@const let constGlobal2: UInt = 2*2
@const let constGlobal3: UInt = 0xf000f000
#if _pointerBitWidth(_64)
@const let constGlobal4: UInt = 0xf000f000_f000f000
#endif
@const let constGlobal5: UInt8 = 255
@const let constGlobal6: UInt32 = 0xffff_ffff