Skip to content
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

Constant extension type as default value doesn't propagate to subclasses #54802

Closed
Zekfad opened this issue Feb 1, 2024 · 2 comments
Closed
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. feature-extension-types Implementation of the extension type feature P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@Zekfad
Copy link

Zekfad commented Feb 1, 2024

Following code produces error, but should not:

extension type const Ext(int _) {}

class A {
  A({
    this.normal = 0,
    this.ext = const Ext(0),
  });
  final int normal;
  final Ext ext;
}

class B extends A {
  B({
    super.normal, // ok
    super.ext, // error
    // The parameter 'ext' can't have a value of 'null' because of its type, but the implicit default value is 'null'.
    // Try adding either an explicit non-'null' default value or the 'required' 
  });
}
@lrhn
Copy link
Member

lrhn commented Feb 1, 2024

Ooooh, good catch!

@lrhn lrhn added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) feature-extension-types Implementation of the extension type feature labels Feb 2, 2024
@scheglov scheglov added the P1 A high priority bug; for example, a single project is unusable or has many test failures label Feb 3, 2024
@scheglov scheglov self-assigned this Feb 3, 2024
@scheglov
Copy link
Contributor

scheglov commented Feb 3, 2024

https://dart-review.googlesource.com/c/sdk/+/350160

copybara-service bot pushed a commit that referenced this issue Feb 5, 2024
…e super default value.

Bug: #54802
Change-Id: I01984f6db0ff61d5b24a1363feeb4185e64d31ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350160
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
@scheglov scheglov closed this as completed Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. feature-extension-types Implementation of the extension type feature P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants