Skip to content

Using unresolved identifier in static context is not compile-time error anymore #6838

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
scheglov opened this issue Nov 20, 2012 · 7 comments
Labels
area-test Cross-cutting test issues (use area- labels for specific failures; not used for package:test). closed-stale Closed as the issue or PR is assumed stale P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@scheglov
Copy link
Contributor

language/import_combinators_negative_test
language/unresolved_top_level_var_negative_test

From Gilad:

At this point this is a static warning and a runtime error. It looks like the spec omits to describe the static warning. I will fix this by adding:

It is as static warning if an identifier expression of the form id occurs inside a top level or static function (be it function, method, getter, or setter) or variable initializer and there is no declaration d with name id in the lexical scope enclosing the expression.

@DartBot
Copy link

DartBot commented Nov 29, 2012

This comment was originally written by [email protected]


In the wake of https://code.google.com/p/co19/issues/detail?id=332 that was recently filed by you:

There seems to be an inconsistency in how VM treats unresolved identifiers with and without arguments in a certain context.

Consider an example:

topLevelFunc() {
  declaredId; //library variable/getter/function object
  declaredId(args); // library function invocation
  (declaredId)(args); // same as above

  undeclaredId; // NoSuchMethodError
  undeclaredId(args); // compile-time error (implicit 'this' reference in a static/TL context) because there's no NSME clause in 12.14.3
  (undeclaredId)(args); // NSME again
}

same for a static context

This could be called counterintuitive

@anders-sandholm
Copy link
Contributor

Removed this from the M2 milestone.
Added this to the M3 milestone.

@anders-sandholm
Copy link
Contributor

Removed this from the M3 milestone.
Added this to the M4 milestone.

@larsbak
Copy link

larsbak commented May 28, 2013

Removed this from the M4 milestone.
Added this to the M5 milestone.

@kasperl
Copy link

kasperl commented Jun 4, 2014

Removed this from the M5 milestone.
Added this to the 1.6 milestone.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the 1.6 milestone.
Added Oldschool-Milestone-1.6 label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-1.6 label.

@scheglov scheglov added Type-Defect area-test Cross-cutting test issues (use area- labels for specific failures; not used for package:test). labels Aug 4, 2014
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed triaged labels Feb 29, 2016
@lrhn lrhn added the closed-stale Closed as the issue or PR is assumed stale label Aug 19, 2024
@lrhn lrhn closed this as completed Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-test Cross-cutting test issues (use area- labels for specific failures; not used for package:test). closed-stale Closed as the issue or PR is assumed stale P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

7 participants