Skip to content

Commit a0ff22e

Browse files
committed
[NFC] Add test for ~Escapable features without NonEscapable feature flag
1 parent a0a012b commit a0ff22e

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
@@ -2807,7 +2807,7 @@ ParserResult<LifetimeAttr> Parser::parseLifetimeAttribute(SourceLoc atLoc,
28072807
SmallVector<LifetimeEntry> lifetimeEntries;
28082808

28092809
if (!Context.LangOpts.hasFeature(Feature::NonescapableTypes)) {
2810-
diagnose(loc, diag::requires_experimental_feature, "lifetime attribute",
2810+
diagnose(loc, diag::requires_experimental_feature, "@lifetime",
28112811
false, getFeatureName(Feature::NonescapableTypes));
28122812
status.setIsParseError();
28132813
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)