mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[nfc] allow ErrorTypeRepr to store a ZeroArgDiagnostic
There are sometimes parsing stuations where we don't want to emit a parsing error, because of feature guarding. For example, if a Feature involves new syntax for a type, we must be able to parse both the true and false sides of an ifdef guarding that new syntax based on a Feature flag.
This commit is contained in:
@@ -1053,7 +1053,7 @@ ParserResult<Pattern> Parser::parseTypedPattern() {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Ty = makeParserResult(new (Context) ErrorTypeRepr(PreviousLoc));
|
||||
Ty = makeParserResult(ErrorTypeRepr::create(Context, PreviousLoc));
|
||||
}
|
||||
|
||||
result = makeParserResult(result,
|
||||
@@ -1278,7 +1278,7 @@ parseOptionalPatternTypeAnnotation(ParserResult<Pattern> result) {
|
||||
|
||||
TypeRepr *repr = Ty.getPtrOrNull();
|
||||
if (!repr)
|
||||
repr = new (Context) ErrorTypeRepr(PreviousLoc);
|
||||
repr = ErrorTypeRepr::create(Context, PreviousLoc);
|
||||
|
||||
return makeParserResult(status, new (Context) TypedPattern(P, repr));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user