Files
swift-mirror/test/Interpreter/unavailable_decl_optimization_stub.swift
Allan Shortlidge da2d250105 Tests: Loosen CHECK: lines matching _diagnoseUnavailableCodeReached().
Depending on deployment target and platform, the function called to diagnose
reaching unavailable code could be `_diagnoseUnavailableCodeReached()` itself,
the back-deployment thunk, or the `@_alwaysEmitIntoClient` variant of the
function.

Resolves rdar://121344690
2024-01-29 09:09:26 -08:00

22 lines
605 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-build-swift -module-name main -Xfrontend -unavailable-decl-optimization=stub %s -o %t/a.out
// RUN: %target-codesign %t/a.out
// RUN: %target-run %t/a.out > %t/output 2>&1 || true
// RUN: %FileCheck %s < %t/output
// REQUIRES: executable_test
@available(*, unavailable)
public func foo() {
print("Can't call this")
}
// To bypass the typechecker, forward declare an available function with the
// same mangling as foo.
@_silgen_name("$s4main3fooyyF")
func callFoo()
// CHECK: Fatal error: Unavailable code reached
// CHECK-NOT: Can't call this
callFoo()