Files
swift-mirror/test/Sema/OSLogSectionName.swift
Doug Gregor e9fc52d065 The os_log section name comes from the module "os" rather than "OSLog"
This was my silly mistake, looking at the wrong module. Fixes
rdar://177629126.
2026-05-21 16:01:47 -07:00

29 lines
1.0 KiB
Swift

// RUN: %empty-directory(%t/src)
// RUN: split-file %s %t/src
// RUN: %target-swift-frontend -typecheck -module-name os %t/src/missing.swift 2>&1 | %FileCheck %s
// RUN: %target-swift-frontend -typecheck -verify -module-name os %t/src/noinit.swift
// RUN: %target-swift-frontend -typecheck -verify -module-name os %t/src/badinit.swift
// RUN: %target-swift-frontend -typecheck -verify -module-name os %t/src/goodinit.swift
//--- missing.swift
// CHECK: global variable 'osLogStringSectionName' is missing from the 'os' module; defaulting to '__TEXT,__oslogstring,cstring_literals'
//--- noinit.swift
// expected-error@+1{{global variable 'osLogStringSectionName' requires a string literal initializer}}
var osLogStringSectionName: String {
"hello"
}
//--- badinit.swift
func getSection() -> String { "hello" }
// expected-error@+1{{global variable 'osLogStringSectionName' requires a string literal initializer}}
let osLogStringSectionName: String = getSection()
//--- goodinit.swift
let osLogStringSectionName = "hello"