Skip to content

interface method cannot have defaulted type parameter #2418

@jvasileff

Description

@jvasileff

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions