Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Package.annotatedMembers<Kind, Annotation> has no constraint on type Annotation type #389

Closed
loicrouchon opened this Issue · 0 comments

2 participants

@loicrouchon
Collaborator

In Package interface, annotatedMembers<Kind, Annotation>() has no constraint on Annotation type

It's declared like this:

"Returns the list of member declarations that satisfy the given `Kind` type argument and
 that are annotated with the given `Annotation` type argument"
shared formal Kind[] annotatedMembers<Kind, Annotation>()
        given Kind satisfies NestableDeclaration;

I would have expected something more like this

import ceylon.language { AnnotationType = Annotation }

"Returns the list of member declarations that satisfy the given `Kind` type argument and
 that are annotated with the given `Annotation` type argument"
shared formal Kind[] annotatedMembers<Kind, Annotation>()
        given Kind satisfies NestableDeclaration
        given Annotation satisfies AnnotationType;

This allows strange things like this pkg.annotatedMembers<FunctionDeclaration, String>() where obviously, String is not an ceylon.language.Annotation subtype

@loicrouchon loicrouchon referenced this issue from a commit in loicrouchon/ceylon.language
@loicrouchon loicrouchon #389 Constrain `Annotation` type parameter to ceylon.language.Annotation
for method  Package.annotatedMembers()
e1b7d52
@loicrouchon loicrouchon referenced this issue from a commit in loicrouchon/ceylon.language
@loicrouchon loicrouchon #389 Constrain `Annotation` type parameter to ceylon.language.Annotation
for methods:
 - ClassOrInterfaceDeclaration.annotatedMemberDeclarations()
 - ClassOrInterfaceDeclaration.annotatedDeclaredMemberDeclarations()
4f39fa5
@FroMage FroMage added this to the 1.1 milestone
@FroMage FroMage closed this in #420
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.