Skip to content

Parser emits compile-time errors on a correct program #48444

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
chloestefantsova opened this issue Feb 21, 2022 · 0 comments
Closed

Parser emits compile-time errors on a correct program #48444

chloestefantsova opened this issue Feb 21, 2022 · 0 comments
Assignees
Labels
legacy-area-front-end Legacy: Use area-dart-model instead.

Comments

@chloestefantsova
Copy link
Contributor

The following program is the repro.

abstract class A {
  void foo() {}
}

class B extends A {
  void bar(bool t) {
    t ? this.foo() : this.foo();
  }
}

The emitted errors are the following:

/tmp/qwerty.dart:7:9: Error: Expected an identifier, but got 'this'.
Try inserting an identifier before 'this'.
    t ? this.foo() : this.foo();
        ^^^^
/tmp/qwerty.dart:7:13: Error: Expected ':' before this.
    t ? this.foo() : this.foo();
            ^
/tmp/qwerty.dart:7:18: Error: Expected ';' after this.
    t ? this.foo() : this.foo();
                 ^
/tmp/qwerty.dart:7:20: Error: Expected an identifier, but got ':'.
Try inserting an identifier before ':'.
    t ? this.foo() : this.foo();
                   ^
/tmp/qwerty.dart:7:20: Error: Unexpected token ';'.
    t ? this.foo() : this.foo();
                   ^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-front-end Legacy: Use area-dart-model instead.
Projects
None yet
Development

No branches or pull requests

1 participant