Skip to content

error with redirecting constructors + optional args + mixins #19226

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
sigmundch opened this issue Jun 4, 2014 · 6 comments
Closed

error with redirecting constructors + optional args + mixins #19226

sigmundch opened this issue Jun 4, 2014 · 6 comments
Assignees
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-duplicate Closed in favor of an existing report

Comments

@sigmundch
Copy link
Member

This program behaves differently if you run it in the VM or with dart2js:

    class A {}
    
    class B extends A {
      B([x]);
    }
    
    class C extends B with A {
      C() : super(0);
    }
    
    main() => print(new C());

The VM fails with this error:

    'file:///home/sigmund/playground/dart_tests/fwderror.dart': error: line 7 pos 24: forwarding constructors must not have optional parameters
    class C extends B with A {
                           ^

And dart2js successfully compiles and runs it. I believe the dart2js behavior is the correct one in this case.

@iposva-google
Copy link
Contributor

Set owner to @crelier.
Added Accepted label.

@sigmundch
Copy link
Member Author

Just chatting with Emily, and she pointed out that there might be a couple language bugs related to this, so I'm not sure what the right action is anymore.

Here are the other relevant bugs:
  - https://code.google.com/p/dart/issues/detail?id=17610
  - https://code.google.com/p/dart/issues/detail?id=15101

@iposva-google
Copy link
Contributor

The one thing that makes me wonder is: Why does dart2js allow this?


Set owner to @gbracha.
Removed Area-VM label.
Added Area-Language label.

@crelier
Copy link
Contributor

crelier commented Jun 5, 2014

See also issues 15101 and 17610.
Improved error message suggesting workaround submitted as r37057.

@lrhn
Copy link
Member

lrhn commented Jun 8, 2014

Most likely reason for dart2js to allow it: They didn't realize that there was this unexpected and unnecessary limitation.

@gbracha
Copy link
Contributor

gbracha commented Aug 26, 2014

Added Duplicate label.
Marked as being merged into #15101.

@sigmundch sigmundch added Type-Defect area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-duplicate Closed in favor of an existing report labels Aug 26, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-duplicate Closed in favor of an existing report
Projects
None yet
Development

No branches or pull requests

6 participants