Files
swift-mirror/test/Sema/invertible_no_stdlib.swift
Kavon Farvardin c9cfe28e6d NCGenerics: improve diagnostics
Removing the old, ad-hoc diagnostics code improves the diagnostics we
emit, since the existing diagnostics for missing conformances is already
pretty good.

rdar://127369509
2024-06-04 15:06:32 -07:00

25 lines
996 B
Swift

// RUN: %target-typecheck-verify-swift -enable-builtin-module \
// RUN: -parse-stdlib -module-name Ghost
// This test covers only rudimentary typechecking when only the Builtin module
// is available. It's not a fully-supported configuration!
import Builtin
func reqCopy1<T>(_ t: T) {} // expected-note {{'where T: Builtin.Copyable' is implicit here}}
func reqCopy2<T: Builtin.Copyable>(_ t: T) {} // expected-note {{'where T: Builtin.Copyable' is implicit here}}
protocol P {}
struct DataType: P, Builtin.Escapable {} // expected-error {{type 'Escapable' requires -enable-experimental-feature NonescapableTypes}}
struct DataTypeNC: ~Builtin.Copyable {}
func main() {
reqCopy1(DataTypeNC()) // expected-error {{global function 'reqCopy1' requires that 'DataTypeNC' conform to 'Builtin.Copyable'}}
reqCopy2(DataTypeNC()) // expected-error {{global function 'reqCopy2' requires that 'DataTypeNC' conform to 'Builtin.Copyable'}}
reqCopy1(DataType())
reqCopy2(DataType())
}