Skip to content

Commit 804cd3e

Browse files
committed
[NFC] Add test for ~Escapable features without NonEscapable feature flag
1 parent 4c7847f commit 804cd3e

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

lib/Parse/ParseDecl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2834,8 +2834,8 @@ ParserResult<LifetimeAttr> Parser::parseLifetimeAttribute(SourceLoc atLoc,
28342834
SourceLoc loc) {
28352835
ParserStatus status;
28362836
if (!Context.LangOpts.hasFeature(Feature::NonescapableTypes)) {
2837-
diagnose(loc, diag::requires_experimental_feature, "lifetime attribute",
2838-
false, getFeatureName(Feature::NonescapableTypes));
2837+
diagnose(loc, diag::requires_experimental_feature, "@lifetime", false,
2838+
getFeatureName(Feature::NonescapableTypes));
28392839
status.setIsParseError();
28402840
return status;
28412841
}
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)