Files
swift-mirror/test/Interpreter/lazy/globals.swift
Nate Chandler ad71233b93 [Test] Require swift_interpreter in a couple tests.
Tests that use %target-jit-run require swift_interpreter.
2023-08-28 13:05:54 -07:00

37 lines
524 B
Swift

// REQUIRES: OS=macosx
// REQUIRES: swift_interpreter
// RUN: %target-jit-run %s -enable-experimental-feature LazyImmediate | %FileCheck %s
// -enable-experimental-feature requires an asserts build
// REQUIRES: asserts
// Tests that piecewise compilation works with global variables
let x = 1
// CHECK: 1
print(x)
fileprivate let y = 2
// CHECK: 2
print(y)
public let z = 3
// CHECK: 3
print(z)
var count = 0
func incr() -> Int {
count += 1
return count
}
// CHECK: 1
print(incr())
// CHECK: 2
print(incr())