Skip to content

Commit fdfeb0e

Browse files
authored
Merge pull request #75647 from slavapestov/fix-issue-74858
Sema: Fix crash with SpecializeExpr around something that's not a type
2 parents 51c7f64 + 43d673c commit fdfeb0e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13980,6 +13980,8 @@ ConstraintSystem::simplifyExplicitGenericArgumentsConstraint(
1398013980
decl = bound->getDecl();
1398113981
for (auto argType : bound->getDirectGenericArgs()) {
1398213982
auto *typeVar = argType->getAs<TypeVariableType>();
13983+
if (!typeVar)
13984+
return SolutionKind::Error;
1398313985
auto *genericParam = typeVar->getImpl().getGenericParameter();
1398413986
openedTypes.push_back({genericParam, typeVar});
1398513987
}

test/Sema/issue-74858.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: %target-typecheck-verify-swift
2+
3+
typealias Alias<T> = Int
4+
5+
func invalidSpecializeExpr(_ x: Alias<Int>.Type) {
6+
let y = x<Int>.self
7+
// expected-error@-1 {{type of expression is ambiguous without a type annotation}}
8+
// FIXME: Bad diagnostic
9+
}

0 commit comments

Comments
 (0)