Skip to content

Commit 0c8b0a3

Browse files
committed
Merge pull request #450 from EliaCereda/sr-197
[SR-197] Skip generic specialization when generic is <<error type>>
2 parents 06e07c4 + 6e5aac0 commit 0c8b0a3

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/Sema/TypeCheckType.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,10 @@ Type TypeChecker::applyGenericArguments(Type type,
367367
if (!unbound) {
368368
// FIXME: Highlight generic arguments and introduce a Fix-It to remove
369369
// them.
370-
diagnose(loc, diag::not_a_generic_type, type);
371-
370+
if (!type->is<ErrorType>()) {
371+
diagnose(loc, diag::not_a_generic_type, type);
372+
}
373+
372374
// Just return the type; this provides better recovery anyway.
373375
return type;
374376
}

test/IDE/print_ast_tc_decls_errors.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ typealias Typealias1 = FooNonExistentProtocol // expected-error {{use of undecla
168168
// NO-TYREPR: {{^}}typealias Typealias1 = <<error type>>{{$}}
169169
// TYREPR: {{^}}typealias Typealias1 = FooNonExistentProtocol{{$}}
170170

171+
// sr-197
172+
func foo(bar: Typealias1<Int>) {} // Should not generate error "cannot specialize non-generic type '<<error type>>'"
173+
171174
// Associated types.
172175

173176
protocol AssociatedType1 {

0 commit comments

Comments
 (0)