Skip to content

"this." field initializer syntax doesn't work with named arguments. #588

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
munificent opened this issue Nov 24, 2011 · 2 comments
Closed
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@munificent
Copy link
Member

I'm trying to use a named argument as a field initializer like so:

class Foo {
  var bar;
  Foo([this.bar]);
}

main() => print(new Foo(bar: 'bar').bar);

And the VM outputs:

NoSuchMethodException - receiver: 'Instance of 'Foo'' function name: 'Foo.' arguments: [-536873450, Instance of 'Foo']]
 0. Function: 'Object.noSuchMethod' url: 'bootstrap' line:93 col:3
 1. Function: 'Foo.Foo.' url: '/.../temp.dart' line:-1 col:-1
 2. Function: '::.main' url: '/.../temp.dart' line:7 col:9

@DartBot
Copy link

DartBot commented Nov 28, 2011

This comment was originally written by @mhausner


The language did not define the semantics of combining initializing formals and optional parameters. The spec has been updated and the VM now supports this.


Set owner to @mhausner.
Added Accepted label.

@DartBot
Copy link

DartBot commented Nov 28, 2011

This comment was originally written by @mhausner


Added Fixed label.

@munificent munificent added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. labels Nov 28, 2011
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

2 participants