native icon indicating copy to clipboard operation
native copied to clipboard

☂️ Support Wildcards (in generics)

Open HosseinYousefi opened this issue 3 years ago • 2 comments

  • [x] dart-lang/native#705
  • [ ] dart-lang/native#704
  • [x] dart-lang/native#693
  • [ ] dart-lang/native#713

HosseinYousefi avatar Nov 18 '22 21:11 HosseinYousefi

Related Generics issues:

dart-lang/native#705 dart-lang/native#704 dart-lang/native#693 dart-lang/native#713

It might be better to map the JLS generics to Dart generics upfront for once, in form of a specification.

mahesh-hegde avatar Mar 23 '23 14:03 mahesh-hegde

I face this problem when implementing parsing of wildcard in asm (TypeUsageSignatureVisitor)[^problem]. So I am looking for a way to solve this if possible.

What are our options here?

  1. ? extends QualifiedName will map to QualifiedName and ? super QualifiedName will map to Object. This is probably easiest to implement, and with current implementation of TypeSignatureVisitor in summarizer, this is what happens anyway.

  2. ? extends QualifiedName will create a new type variable W1 extends QualifiedName. ? super QualifiedName is still Object.

I need to study the generics spec, especially the covariance part, but I would like to listen from those who already have. :)

[^problem]: Map<K, V> uses many ? extends K kind of stuff. Previously +K would get parsed as K but if we want to parse it as ? extends K, we should handle Kind.WILDCARD properly in the generator.

mahesh-hegde avatar Aug 13 '23 16:08 mahesh-hegde