Skip to content

[Sema] Remove a superfluous diagnosis #1308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions lib/Sema/TypeCheckType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ Type TypeChecker::applyGenericArguments(Type type, SourceLoc loc,
if (!type->is<ErrorType>())
diagnose(loc, diag::not_a_generic_type, type)
.fixItRemove(generic->getAngleBrackets());
generic->setInvalid();
return type;
}

Expand Down Expand Up @@ -969,16 +970,6 @@ static Type resolveNestedIdentTypeComponent(
parentRange,
comp);
assert(memberType && "Received null dependent member type");

if (isa<GenericIdentTypeRepr>(comp) && !memberType->is<ErrorType>()) {
// FIXME: Highlight generic arguments and introduce a Fix-It to
// remove them.
if (diagnoseErrors)
TC.diagnose(comp->getIdLoc(), diag::not_a_generic_type, memberType);

// Drop the arguments.
}

// If we know what type declaration we're referencing, store it.
if (auto typeDecl = memberType->getDirectlyReferencedTypeDecl()) {
comp->setValue(typeDecl);
Expand Down
4 changes: 4 additions & 0 deletions test/Generics/function_decls.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ public class A<X> {
public func f10(x:Int) {}
public func f11<T, U>(x:X, y:T) {} //expected-error{{generic parameter 'U' is not used in function signature}}
}

protocol P { associatedtype A }

func f12<T : P>(x: T) -> T.A<Int> {} //expected-error{{cannot specialize non-generic type 'T.A'}}{{29-34=}}