Skip to content

Commit b71ad06

Browse files
committed
[Sema] Remove a superfluous diagnosis
The same diagnostic (but including the Fix-It hint) is already issued twice (!) in `applyGenericArguments`.
1 parent 92fc7db commit b71ad06

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

lib/Sema/TypeCheckType.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -969,16 +969,6 @@ static Type resolveNestedIdentTypeComponent(
969969
parentRange,
970970
comp);
971971
assert(memberType && "Received null dependent member type");
972-
973-
if (isa<GenericIdentTypeRepr>(comp) && !memberType->is<ErrorType>()) {
974-
// FIXME: Highlight generic arguments and introduce a Fix-It to
975-
// remove them.
976-
if (diagnoseErrors)
977-
TC.diagnose(comp->getIdLoc(), diag::not_a_generic_type, memberType);
978-
979-
// Drop the arguments.
980-
}
981-
982972
// If we know what type declaration we're referencing, store it.
983973
if (auto typeDecl = memberType->getDirectlyReferencedTypeDecl()) {
984974
comp->setValue(typeDecl);

test/Generics/function_decls.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,10 @@ public class A<X> {
3535
public func f10(x:Int) {}
3636
public func f11<T, U>(x:X, y:T) {} //expected-error{{generic parameter 'U' is not used in function signature}}
3737
}
38+
39+
protocol P { associatedtype A }
40+
41+
// FIXME: only emit this diagnostic once
42+
func f12<T : P>(x: T) -> T.A<Int> {}
43+
// expected-error @-1 {{cannot specialize non-generic type 'T.A'}}
44+
// expected-error @-2 {{cannot specialize non-generic type 'T.A'}}

0 commit comments

Comments
 (0)