Skip to content

Commit acd0ba6

Browse files
committed
---
yaml --- r: 344829 b: refs/heads/master c: b33a46b h: refs/heads/master i: 344827: b1145d7
1 parent 660550f commit acd0ba6

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 792ce192f89160fd693f58a5bdbe1b66e1ce6df4
2+
refs/heads/master: b33a46b24edcb4feb34af5c73e37c7701aec1105
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/lib/Parse/ParsePattern.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,14 @@ mapParsedParameters(Parser &parser,
429429
paramNameLoc, paramName,
430430
parser.CurDeclContext);
431431
param->getAttrs() = paramInfo.Attrs;
432+
433+
auto setInvalid = [&]{
434+
if (param->isInvalid())
435+
return;
436+
param->getTypeLoc().setInvalidType(ctx);
437+
param->setInvalid();
438+
};
439+
432440
bool parsingEnumElt
433441
= (paramContext == Parser::ParameterContextKind::EnumElement);
434442
// If we're not parsing an enum case, lack of a SourceLoc for both
@@ -438,7 +446,7 @@ mapParsedParameters(Parser &parser,
438446

439447
// If we diagnosed this parameter as a parse error, propagate to the decl.
440448
if (paramInfo.isInvalid)
441-
param->setInvalid();
449+
setInvalid();
442450

443451
// If a type was provided, create the type for the parameter.
444452
if (auto type = paramInfo.Type) {
@@ -462,8 +470,7 @@ mapParsedParameters(Parser &parser,
462470
if (!param->isInvalid())
463471
parser.diagnose(param->getLoc(), diag::missing_parameter_type);
464472

465-
param->getTypeLoc() = TypeLoc::withoutLoc(ErrorType::get(ctx));
466-
param->setInvalid();
473+
setInvalid();
467474
} else if (paramInfo.SpecifierLoc.isValid()) {
468475
StringRef specifier;
469476
switch (paramInfo.SpecifierKind) {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: not %target-swift-frontend -typecheck %s
2+
3+
func receive() {}
4+
func test() {
5+
receive { (dat: Container<>) in
6+
dat
7+
}
8+
}

0 commit comments

Comments
 (0)