Skip to content

Commit 1c05ae8

Browse files
committed
AST: Stricter contract for Type::subst()
Fix an odd corner case when UseErrorTypes was off; we would return the empty type if dependent member type substitution failed, but otherwise return the original type if it was a generic type parameter or an archetype. Now, if UseErrorTypes is off, return the empty type in both cases, even if the original type is 'primary'.
1 parent 5e2f5d6 commit 1c05ae8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/AST/Type.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2971,7 +2971,7 @@ static Type substType(Type derivedType,
29712971
if (isa<GenericTypeParamType>(substOrig)) {
29722972
if (options.contains(SubstFlags::UseErrorType))
29732973
return ErrorType::get(type);
2974-
return Type(type);
2974+
return Type();
29752975
}
29762976

29772977
auto archetype = cast<ArchetypeType>(substOrig);
@@ -2987,7 +2987,7 @@ static Type substType(Type derivedType,
29872987
if (!parent) {
29882988
if (options.contains(SubstFlags::UseErrorType))
29892989
return ErrorType::get(type);
2990-
return Type(type);
2990+
return Type();
29912991
}
29922992

29932993
// Substitute into the parent type.

0 commit comments

Comments
 (0)