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

VM allows this initializers of private fields in constructors. #3502

Closed
DartBot opened this issue Jun 11, 2012 · 7 comments
Closed

VM allows this initializers of private fields in constructors. #3502

DartBot opened this issue Jun 11, 2012 · 7 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

Comments

@DartBot
Copy link

DartBot commented Jun 11, 2012

This issue was originally filed by zundel@google.com


// Spec. version 6.2.2: It is a compile-time error if a named formal parameter begins with an '_'

class Foo {
  num _y;
  Foo.optional_private([this._y = 77]) {} // illegal named parameter starts with _
}

main() {
  var obj;
  obj = new Foo.optional_private(_y: 222);
  Expect.equals(222, obj._y);

  obj = new Foo.optional_private();
  Expect.equals(77, obj._y);
}

See forthcoming parameter_initializer6_negative_test

Comment from gbracha: "Yes, that is illegal per the spec. It might be easier to deal with this once we add positional optional parameters, which should be coming to a spec near you in the near future. "

There are some libraries that currently violate this rule and I'm cleaning them up before I commit the new test:

http://codereview.chromium.org/10541095/

@iposva-google
Copy link
Contributor

Set owner to @kmillikin.

@iposva-google
Copy link
Contributor

Is this still a valid bug report?


Set owner to @gbracha.

@gbracha
Copy link
Contributor

gbracha commented May 29, 2013

Yes. The spec still says that named parameters cannot be have their name start with _.

@iposva-google
Copy link
Contributor

Removed Priority-Medium label.
Added Priority-Unassigned label.

@DartBot
Copy link
Author

DartBot commented Aug 26, 2013

This comment was originally written by @mhausner


Added Started label.

@DartBot
Copy link
Author

DartBot commented Aug 26, 2013

This comment was originally written by @mhausner


Set owner to @mhausner.

@DartBot
Copy link
Author

DartBot commented Aug 27, 2013

This comment was originally written by @mhausner


https://codereview.chromium.org/23478005/
Committed at 26719


Added Fixed label.

@DartBot DartBot added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. labels Aug 27, 2013
copybara-service bot pushed a commit that referenced this issue Sep 25, 2023
Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (https://github.com/dart-lang/dartdoc/compare/0e1a6d9..a3cfdc4):
  a3cfdc40  2023-09-20  Sam Rawlins  Rename Feature to Attribute (#3499)
  497a685b  2023-09-18  dependabot[bot]  Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (#3502)

ecosystem (https://github.com/dart-lang/ecosystem/compare/dcf5c4f..3da2dd3):
  3da2dd3  2023-09-22  Moritz  Allow both single-workflow and fork-enabled publishing validation (#174)

native (https://github.com/dart-lang/native/compare/a5d8809..be4aaf7):
  be4aaf7  2023-09-23  Daniel Breedeveld  Fix Header filename mismatch causing ffigen to produce empty output (#141)

Change-Id: Id8fe3ff92185bc366899f6634c6058b174ed9f82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/327760
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
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

3 participants