Skip to content
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

interface method cannot have defaulted type parameter #2418

Open
jvasileff opened this issue Nov 6, 2015 · 0 comments
Open

interface method cannot have defaulted type parameter #2418

jvasileff opened this issue Nov 6, 2015 · 0 comments

Comments

@jvasileff
Copy link
Member

A class that satisfies an interface that has a default implementation of a method with a defaulted type parameter that is used in the method's signature cannot be compiled.

shared interface I {
    shared void f<T=Null>(Singleton<T> s) {}
}

shared class C() satisfies I {}
$ ceylon compile
source/simple/run.ceylon:5: error: C is not abstract and does not override abstract method <T>f(TypeDescriptor,Singleton<? extends T>) in I
shared class C() satisfies I {}
^
  where T is a type-variable:
    T extends Object declared in method <T>f(TypeDescriptor,Singleton<? extends T>)
error: name clash: <T#1>f(TypeDescriptor,Singleton<? extends Object>) in C and <T#2>f(TypeDescriptor,Singleton<? extends T#2>) in I have the same erasure, yet neither overrides the other
  where T#1,T#2 are type-variables:
    T#1 extends Object declared in method <T#1>f(TypeDescriptor,Singleton<? extends Object>)
    T#2 extends Object declared in method <T#2>f(TypeDescriptor,Singleton<? extends T#2>)
2 errors
Note: Created module simple/1.0.0
ceylon compile: There were 2 errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants