Skip to content

Fasta generates Kernel that does not correspond to the original code AST #30267

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

Open
scheglov opened this issue Jul 26, 2017 · 1 comment
Open
Assignees
Labels
legacy-area-front-end Legacy: Use area-dart-model instead.

Comments

@scheglov
Copy link
Contributor

For the following code:

class C {}
const V = const C.named();

The following Kernel is generated.

library;
import self as self;
import "dart:core" as core;

class C extends core::Object {
  default constructor •() → void
    : super core::Object::•()
    ;
}
static const field dynamic V = const core::_ConstantExpressionError::•()._throw(new core::_CompileTimeError::•("file:///test.dart:2:17: Error: Method not found: 'C.named'.\nconst V = const C.named();\n                ^"));

As you can see, it does not correspond to the original Dart code - there is no _throw in the Dart code, and both C and named are lost. There is no way for Analyzer to resynthesize correct element model from this Kernel.

@scheglov scheglov added the legacy-area-front-end Legacy: Use area-dart-model instead. label Jul 26, 2017
@sigmundch
Copy link
Member

Let's make sure to discuss this in detail as soon as we are all available (I believe Peter is out this week).

This falls under the general umbrella of how do we want to represent erroneous code and handle error recovery.

@scheglov you might be interested also in #29840, where Peter was proposing changes to the IR to represent these erroneous cases like these.

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

3 participants