Skip to content

Commit d78f8d6

Browse files
committed
[NFC] Add test for ~Escapable features without NonEscapable feature flag
1 parent 718e0cb commit d78f8d6

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/Parse/ParseDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2798,7 +2798,7 @@ ParserResult<LifetimeAttr> Parser::parseLifetimeAttribute(SourceLoc atLoc,
27982798
SmallVector<LifetimeEntry> lifetimeEntries;
27992799

28002800
if (!Context.LangOpts.hasFeature(Feature::NonescapableTypes)) {
2801-
diagnose(loc, diag::requires_experimental_feature, "lifetime attribute",
2801+
diagnose(loc, diag::requires_experimental_feature, "@lifetime",
28022802
false, getFeatureName(Feature::NonescapableTypes));
28032803
status.setIsParseError();
28042804
return status;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %target-typecheck-verify-swift -disable-availability-checking
2+
// REQUIRES: asserts
3+
4+
struct NE : ~Escapable { // expected-error{{type 'Escapable' requires -enable-experimental-feature NonescapableTypes}}
5+
6+
}
7+
8+
@lifetime(ne) // expected-error{{'@lifetime' attribute is only valid when experimental feature NonescapableTypes is enabled}} expected-error{{expected declaration}}
9+
func derive(_ ne: NE) -> NE {
10+
ne
11+
}

0 commit comments

Comments
 (0)