Skip to content

Commit d3aaf66

Browse files
committed
AST: Spot fix for latent issue with thrown error in transformWithPosition()
We probably don't have a way to exercise this, but the thrown error type appears in the same position as the function, instead of being invariant. That is, we wish to allow converting `() throws(E) -> ()` into `() throws(F) -> ()` when E converts to F.
1 parent 2269c80 commit d3aaf66

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/AST/Type.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5045,8 +5045,7 @@ case TypeKind::Id:
50455045
// Transform the thrown error.
50465046
Type thrownError;
50475047
if (Type origThrownError = function->getThrownError()) {
5048-
thrownError = origThrownError.transformWithPosition(
5049-
TypePosition::Invariant, fn);
5048+
thrownError = origThrownError.transformWithPosition(pos, fn);
50505049
if (!thrownError)
50515050
return Type();
50525051

0 commit comments

Comments
 (0)