|
Re: Type parameter as type of both attribute and reference [message #1710088 is a reply to message #1709701] |
Sun, 04 October 2015 07:38 |
Ed Merks Messages: 33113 Registered: July 2009 |
Senior Member |
|
|
Hallvard,
Comments below.
On 30/09/2015 3:31 PM, Hallvard Trætteberg wrote:
> I have a student who's trying to understand how generics works, and to
> test possible limitations we created an EClass with a type paramter T
> (Gen<T>) and two features:
> - an EAttribute of type T
> - an EReference of type T
> The EClass validated!
I suppose something should check that some type argument could be
provided that would result in a consistent interpretation.
>
> Then we created another EClass wil a feature of type Gen<AnEClass>.
I suppose something should at least check that the actual arguments
result in a consistent interpretation.
> This class also validated, although the type of the feature could not
> possibly have an attribute of type AnEClass. We also created a
> subclass of Gen specialized to AnEClass (Spec extends Gen<AnEClass>)
> i.e. Same story, it validated, but couldn't work, since it needed to
> have an attribute of EClass type.
Likewise for this.
I wonder what's generated and what fails at runtime instead...
>
> Should this be considered a bug?
It sounds like something that could/should be detected earlier.
>
> Hallvard
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02615 seconds