Skip to content

Commit 91dc1cf

Browse files
committed
Merge pull request #1308 from JaSpa/superfluous-diag
[Sema] Remove a superfluous diagnosis
2 parents 9634db0 + 6549553 commit 91dc1cf

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

lib/Sema/TypeCheckType.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ Type TypeChecker::applyGenericArguments(Type type, SourceLoc loc,
395395
if (!type->is<ErrorType>())
396396
diagnose(loc, diag::not_a_generic_type, type)
397397
.fixItRemove(generic->getAngleBrackets());
398+
generic->setInvalid();
398399
return type;
399400
}
400401

@@ -969,16 +970,6 @@ static Type resolveNestedIdentTypeComponent(
969970
parentRange,
970971
comp);
971972
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-
982973
// If we know what type declaration we're referencing, store it.
983974
if (auto typeDecl = memberType->getDirectlyReferencedTypeDecl()) {
984975
comp->setValue(typeDecl);

test/Generics/function_decls.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,7 @@ 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+
func f12<T : P>(x: T) -> T.A<Int> {} //expected-error{{cannot specialize non-generic type 'T.A'}}{{29-34=}}

0 commit comments

Comments
 (0)