Files
swift-mirror/test/TBD/objc-entry-point.swift
Harlan 096e6adb3f [TBDGen] Fix check for global accessors (#18883)
Previously, TBDGen skipped emitting lazy initializers for globals that
appeared in any file with an entry point. This breaks, however on files
that have an NSApplicationMain/UIApplicationMain class in them, where
the entry point is synthesized but top-level globals are not locally
scoped. This change re-uses SILGen's check and only skips variable
declarations that appear at top level in a script mode file.

Resolves rdar://43549749
2018-08-21 18:22:59 -07:00

15 lines
646 B
Swift

// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-ir -o /dev/null -validate-tbd-against-ir=all -parse-as-library -verify -enable-testing %s
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-ir -o /dev/null -validate-tbd-against-ir=all -parse-as-library -verify %s
// REQUIRES: objc_interop
import AppKit
// Globals in non-script mode files that still have entry points
// (via NSApplicationMain) _do_ have lazy initializers. Ensure the symbols are
// present in the TBD.
let globalConstantWithLazyInitializer: String = "hello, world"
@NSApplicationMain
class MyDelegate: NSObject, NSApplicationDelegate {
}