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

Already on GitHub? Sign in to your account

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

Closed
loicrouchon opened this Issue Jan 6, 2014 · 0 comments

Comments

Projects
None yet
2 participants
Member

loicrouchon commented Jan 6, 2014

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 added a commit to loicrouchon/ceylon.language that referenced this issue Mar 22, 2014

loicrouchon added a commit to loicrouchon/ceylon.language that referenced this issue Mar 22, 2014

#389 Constrain `Annotation` type parameter to ceylon.language.Annotation
for methods:
 - ClassOrInterfaceDeclaration.annotatedMemberDeclarations()
 - ClassOrInterfaceDeclaration.annotatedDeclaredMemberDeclarations()

@FroMage FroMage added this to the 1.1 milestone Apr 3, 2014

@FroMage FroMage closed this in #420 Apr 3, 2014

FroMage added a commit that referenced this issue Apr 3, 2014

Merge pull request #420 from loicrouchon/contrain-annotation-type-in-…
…metamodel


Fix #389: Contrain annotation type in metamodel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment