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

Incorrect missing operator warning if []= is defined but not [] #857

Closed
DartBot opened this issue Dec 14, 2011 · 3 comments
Closed

Incorrect missing operator warning if []= is defined but not [] #857

DartBot opened this issue Dec 14, 2011 · 3 comments
Labels
closed-not-planned Closed as we don't intend to take action on the reported issue

Comments

@DartBot
Copy link

DartBot commented Dec 14, 2011

This issue was originally filed by [email protected]


Consider the following code:

main() {
  Fred fred = new Fred();
  int x = 7, y = 23;
  String result = (fred[x] = y);
  print("Got result $result");
}

class Fred {
  String operator []=(int x, int y) {
    print("Inside []= operator code, x = $x, y = $y");
    return "${x} + ${y} = ${x + y}";
  }
}

When I run this on dartboard, it shows a warning: "Fred has no method named 'operator[]'".
It then appears to successfully execute the code and invoke the operator code.

So it appears to be warning incorrectly, but otherwise ignoring the issue. If I add the operator [] to Fred, the warning goes away.

Jason

@DartBot
Copy link
Author

DartBot commented Dec 14, 2011

This comment was originally written by [email protected]


I should note, that running this code on the stand-alone vm does not produce this warning.

@DartBot
Copy link
Author

DartBot commented Dec 15, 2011

This comment was originally written by [email protected]


Removed Area-Language label.
Added Area-Dartboard, Triaged labels.

@dgrove
Copy link
Contributor

dgrove commented Jan 11, 2013

At some point, we would like to create a next-generation Dartboard. In the meantime, dartboard has been deprecated.


Added WontFix label.

@kevmoo kevmoo added closed-not-planned Closed as we don't intend to take action on the reported issue and removed resolution-wont_fix labels Mar 1, 2016
copybara-service bot pushed a commit that referenced this issue Jun 29, 2023
…uf, test

Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (https://github.com/dart-lang/dartdoc/compare/e04a6b3..c2ed703):
  c2ed703c  2023-06-26  dependabot[bot]  Bump ossf/scorecard-action from 2.1.3 to 2.2.0 (#3454)

ecosystem (https://github.com/dart-lang/ecosystem/compare/b1056e6..19fa443):
  19fa443  2023-06-29  Lasse R.H. Nielsen  Clean-up and tweaks of the firehose project. (#117)
  9ef5948  2023-06-27  Moritz  Excise health from firehose (#118)
  36c662e  2023-06-27  Moritz  Introduce a health checking workflow (#115)

http (https://github.com/dart-lang/http/compare/ff1fcfe..d68081f):
  d68081f  2023-06-26  Nate Bosch  Prepare to publish package:http (#973)
  067bff3  2023-06-26  Alex James  Create java http package (#971)

lints (https://github.com/dart-lang/lints/compare/79581ff..89f9519):
  89f9519  2023-06-28  Parker Lougheed  Fix typo in 3.0.0-wip changelog entry (#137)

markdown (https://github.com/dart-lang/markdown/compare/bd6ae8d..4674d09):
  4674d09  2023-06-27  Zhiguang Chen  Fix HtmlBlockSyntax (#548)

mockito (https://github.com/dart-lang/mockito/compare/1d6064a..974226e):
  974226e  2023-06-27  Googler  Internal change

protobuf (https://github.com/dart-lang/protobuf/compare/e76bd74..7bebbc6):
  7bebbc6  2023-06-29  Ömer Sinan Ağacan  Update protoc_plugin Makefile: (#858)
  acc0462  2023-06-29  Ömer Sinan Ağacan  Ignore non-items in message sets (#857)
  0eb3796  2023-06-29  Ömer Sinan Ağacan  Ignore unknown tags in message set items (#856)
  2996e1d  2023-06-27  Ömer Sinan Ağacan  Implement message set wire format (#836)

test (https://github.com/dart-lang/test/compare/cdc8178..021667a):
  021667a4  2023-06-28  Jacob MacDonald  prep to release (#2048)
  3d44fcae  2023-06-28  Yaroslav Vorobev  feat(test): add MOZ_AUTOMATION=1 to ff test runner (#2049)
  6e675f80  2023-06-28  Parker Lougheed  Replace broken link to observatory with DevTools mention (#2047)
  2904779b  2023-06-28  Yaroslav Vorobev  feat(runner): add env overrides for safari and ff (#2042)
  54350282  2023-06-28  Parker Lougheed  Update link from old linter site to dart.dev (#2046)
  8c4b15d1  2023-06-28  Jacob MacDonald  allow the latest analyzer (6.x.x) (#2045)

Change-Id: I86901fb2211adf81288f0940a355d6c33ddd8a7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311927
Auto-Submit: Devon Carew <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-not-planned Closed as we don't intend to take action on the reported issue
Projects
None yet
Development

No branches or pull requests

3 participants