Files
swift-mirror/test/Sema/copyable_constraint.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

16 lines
686 B
Swift

// >> First verify that when building the stdlib, we do have the copyable constraint. Note the module-name!!
// RUN: %target-swift-frontend -typecheck -verify -parse-stdlib -module-name Swift %s
// Demonstrate that plain -parse-stdlib, such as in some arbitrary test, does still get the Copyable constraint
// RUN: %target-swift-frontend -typecheck -verify -parse-stdlib %s
@_marker public protocol Copyable {}
func nextTime<T>(_ t: T) {} // expected-note {{Copyable' is implicit here}}
@_moveOnly struct MO {}
// NOTE: when building without being the stdlib, we get a Builtin.Copyable
nextTime(MO()) // expected-error {{global function 'nextTime' requires that 'MO' conform to}}