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

Function literal with square brackets not an assignable expression #2709

Closed
DartBot opened this issue Apr 24, 2012 · 9 comments
Closed

Function literal with square brackets not an assignable expression #2709

DartBot opened this issue Apr 24, 2012 · 9 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-obsolete Closed as the reported issue is no longer relevant

Comments

@DartBot
Copy link

DartBot commented Apr 24, 2012

This issue was originally filed by [email protected]


Spec (0.08) says:

ch 10 - function literal is a primary:
primary:
...
functionExpression |
...

10.27:
assignableExpression:
primary (argument* assignableSelector)+ |
super assignableSelector |
identi fier
;

assignableSelector:
[' expression]' |
`.' identi fier
;

which should mean that something like 'void foo() {}[0]' is an assignable expression and can be used with a postfix operator:

postfi xExpression:
assignableExpression post fixOperator |
...

However, the following test fails on VM:
'file:///media/sf_dart_local/co19/tests/co19/src/Language/10_Expressions/26_Postfix_Expressions_A01_t01.dart': Error: line 64 pos 26: expression is not assignable
    try { void f() {} [0]++; } catch(var e) {}
                         ^

might be related to issue #1189

@DartBot
Copy link
Author

DartBot commented Apr 24, 2012

This comment was originally written by [email protected]


The same productions lead us to believe that the following should be allowed (but isn't):

Error: line 65 pos 22: unexpected token '.'
    try { void f() {}.x; } catch(var e) {}
                     ^
    try { void f() {}.x++; } catch(var e) {}
                     ^

@madsager
Copy link
Contributor

Added Area-VM, Triaged labels.

@iposva-google
Copy link
Contributor

Set owner to @gbracha.
Added Accepted label.

@gbracha
Copy link
Contributor

gbracha commented Jun 1, 2012

Once we finalize 1676 and 1189 we'll be able to proceed on this.

@iposva-google
Copy link
Contributor

Gilad, any update?

@gbracha
Copy link
Contributor

gbracha commented May 29, 2013

Function expressions have changed since this was filed (and so has try-catch). Function expressions have no return type and no name, so the examples should now look like this:

  try { () {}.x; } catch(e) {};
  try { () {}.x++; } catch(e) {};

these are syntactically legal (though they give rise to warnings and will fail at runtime). So I think the issue is moot.

@iposva-google
Copy link
Contributor

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

@iposva-google
Copy link
Contributor

Interpreting "issue is moot" as "AssumedStale".

@iposva-google
Copy link
Contributor

Added AssumedStale label.

@DartBot DartBot added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-obsolete Closed as the reported issue is no longer relevant labels Oct 2, 2013
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. closed-obsolete Closed as the reported issue is no longer relevant
Projects
None yet
Development

No branches or pull requests

4 participants