Skip to content

Support for type arguments in redirecting factory constuctors #31605

New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
scheglov opened this issue Dec 11, 2017 · 4 comments
Closed

Support for type arguments in redirecting factory constuctors #31605

scheglov opened this issue Dec 11, 2017 · 4 comments
Assignees
Labels
customer-analyzer legacy-area-front-end Legacy: Use area-dart-model instead. P3 A lower priority bug or feature request

Comments

@scheglov
Copy link
Contributor

The kernel I get from front-end has invalid-expression and does not include type arguments.

class A<T> implements B<T> {
  A(int a);
  A.named(double a);
}
class B<U> {
  factory B.one(int b) = A<U>;
  factory B.two(double b) = A<U>.named;
}
library;
import self as self;
import "dart:core" as core;

class A<T extends core::Object> extends core::Object implements self::B<self::A::T> {
  constructor •(core::int a) → void
    : super core::Object::•()
    ;
  constructor named(core::double a) → void
    : super core::Object::•()
    ;
}
class B<U extends core::Object> extends core::Object {
  static field dynamic _redirecting# = <dynamic>[self::B::one, self::B::two];
  static factory one<U extends core::Object>(core::int b) → self::B<self::B::one::U>
    let dynamic #redirecting_factory = self::A::• in invalid-expression;
  static factory two<U extends core::Object>(core::double b) → self::B<self::B::two::U>
    let dynamic #redirecting_factory = self::A::named in invalid-expression;
}

See also #30258

@scheglov scheglov added legacy-area-front-end Legacy: Use area-dart-model instead. customer-analyzer P1 A high priority bug; for example, a single project is unusable or has many test failures labels Dec 11, 2017
@eernstg
Copy link
Member

eernstg commented Dec 12, 2017

You may have noted that the grammar in the language specification does not allow for passing type arguments after = in a redirecting factory constructor declaration. Could that in some indirect manner be the source of the problem?

In any case, the specification of checks applied to redirecting constructors have been updated substantially in this CL, which also adds typeParameters? to the syntax.

@scheglov scheglov added P2 A bug or feature request we're likely to work on and removed P1 A high priority bug; for example, a single project is unusable or has many test failures labels Dec 12, 2017
@scheglov
Copy link
Contributor Author

Hm... I think the specification allows type arguments in redirection.
See http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-408.pdf

image

image

@eernstg
Copy link
Member

eernstg commented Dec 13, 2017

Good catch, it does indeed allow type arguments already, and the grammar change is reverted now.

@jensjoha jensjoha added P3 A lower priority bug or feature request and removed P2 A bug or feature request we're likely to work on labels Jan 10, 2018
@chloestefantsova
Copy link
Contributor

Fixed in ec9c927.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-analyzer legacy-area-front-end Legacy: Use area-dart-model instead. P3 A lower priority bug or feature request
Projects
None yet
Development

No branches or pull requests

4 participants