Skip to content

[CFE] Incremental compilation for factory constructor call differs from non-incremental #41976

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
annagrin opened this issue May 20, 2020 · 0 comments
Labels
legacy-area-front-end Legacy: Use area-dart-model instead.

Comments

@annagrin
Copy link
Contributor

annagrin commented May 20, 2020

Example (library foo.dart):

abstract class Key {
  const factory Key(String value) = ValueKey;
  const Key.empty();
}

abstract class LocalKey extends Key {
  const LocalKey() : super.empty();
}

class ValueKey implements LocalKey {
  const ValueKey(this.value);
  final String value;
}

void main() {
   var k = Key('t');
   /* breakpoint here */
  print('$k');
}

Initial compilation

of expression Key('t') generates following kernel:

new #lib1::ValueKey::•("t")

Incremental compilation

#lib1::Key::•("t")

This causes DDC to create incorrect JS that evaluates to null at runtime:

foo.Key.new("t")

Repro

See skipped tests in pkg/frontend_server/lib/src/expression_compiler.dart in
https://dart-review.googlesource.com/c/sdk/+/148468

@srawlins srawlins added the legacy-area-front-end Legacy: Use area-dart-model instead. label May 20, 2020
dart-bot pushed a commit that referenced this issue Jun 4, 2020
…lations

Also add reproduction for issue #41976.

Change-Id: I65c55ce0b7ef65e28903b924945e148a1a2285d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149844
Reviewed-by: Johnni Winther <[email protected]>
Commit-Queue: Jens Johansen <[email protected]>
dart-bot pushed a commit that referenced this issue Jul 10, 2020
#41976

Change-Id: Ia294b421f52a9cccd98198e16fd17d3eff7e9238
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153941
Reviewed-by: Johnni Winther <[email protected]>
Commit-Queue: Anna Gringauze <[email protected]>
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

2 participants