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

Local function parameters appear to be entered in wrong scope. #388

Closed
rakudrama opened this issue Nov 9, 2011 · 5 comments
Closed

Local function parameters appear to be entered in wrong scope. #388

rakudrama opened this issue Nov 9, 2011 · 5 comments
Assignees
Milestone

Comments

@rakudrama
Copy link
Member

The error message below complains that the formal is a duplicate definition - is it being entered into the wrong scope?

bug7.dart:
main() {
  tag(tag, s) => s === null ? '' : '$tag$s';
  print('${tag('x=', 8)}');
}

$ frogsh --enable_type_checks bug7.dart
bug7.dart:2:7: error: duplicate name "tag"
  tag(tag, s) => s === null ? '' : '$tag$s';
      ^^^
compilation failed with 1 errors
$ dart_bin --enable_type_checks --warning_as_error bug7.dart
x=8
$

@dgrove
Copy link
Contributor

dgrove commented Nov 29, 2011

Added this to the FrogEditor milestone.

@jmesserly
Copy link

Added Started label.

@jmesserly
Copy link

The trick is, it can't be entered into the enclosing scope either, because of cases such as:
void main() {
  print((fib(x) => (x <= 1 ? x : fib(x-1)+fib(x-2)))(10)); // works: 55
// print(fib(10)); // error: fib not declared
}

suspect we need to do something goofy for lambda expressions, like generate an intermediate scope if they happen to have a name.

@jmesserly
Copy link

Set owner to @jmesserly.

@jmesserly
Copy link

Added Fixed label.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants