Files
swift-mirror/test/Sema/availability_enum_case.swift
Slava Pestov 765ce78992 Sema: Downgrade potentially unavailable enum cases to a warning in module interfaces
There are two pieces here:

- A -warn-on-potentially-unavailable-enum-case flag is passed down by
  the driver when *producing* a swiftinterface

- When *consuming* a swiftinterface, also enable this behavior

Part of rdar://problem/78306593.
2021-06-08 23:38:35 -04:00

20 lines
880 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-build-swift -emit-module %S/Inputs/availability_enum_case_other.swift -emit-module-interface-path %t/availability_enum_case_other.swiftinterface -swift-version 5 -enable-library-evolution
// RUN: %target-typecheck-verify-swift -I %t
// RUN: %target-build-swift -emit-module %S/Inputs/availability_enum_case_other.swift -emit-module-interface-path %t/availability_enum_case_other.swiftinterface -swift-version 5 -enable-library-evolution -whole-module-optimization
// RUN: %target-typecheck-verify-swift -I %t
// REQUIRES: OS=macosx
import availability_enum_case_other
func ride(horse: Horse) {
// expected-note@-1 {{add @available attribute to enclosing global function}}
_ = Horse.kevin
// expected-error@-1 {{'kevin' is only available in macOS 100 or newer}}
// expected-note@-2 {{add 'if #available' version check}}
}