Skip to content

Commit

Permalink
Stop randomly stripping IdentityExprs from recursive positions
Browse files Browse the repository at this point in the history
within accessors.

Improves source fidelity and fixes problems with error handling
(because TryExpr and ForceTryExpr are IdentityExprs).

Swift SVN r28298
  • Loading branch information
rjmccall committed May 7, 2015
1 parent 8dac375 commit 54d3d5f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 0 additions & 4 deletions lib/Sema/MiscDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,6 @@ static void diagRecursivePropertyAccess(TypeChecker &TC, const Expr *E,
}
}

} else if (auto *PE = dyn_cast<IdentityExpr>(E)) {
// Look through ParenExprs because a function argument of a single
// rvalue will have a LoadExpr /outside/ the ParenExpr.
return { true, PE->getSubExpr() };
}

return { true, E };
Expand Down
12 changes: 12 additions & 0 deletions test/stmt/errors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,15 @@ func six() {
} catch _ {
}
}

func seven_helper() throws -> Int { throw MSV.Baz }

struct seven {
var x: Int {
do {
return try seven_helper()
} catch {
return 0
}
}
}

0 comments on commit 54d3d5f

Please sign in to comment.