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

bug when sharing deferred constants #31306

Closed
sigmundch opened this issue Nov 7, 2017 · 0 comments
Closed

bug when sharing deferred constants #31306

sigmundch opened this issue Nov 7, 2017 · 0 comments
Assignees

Comments

@sigmundch
Copy link
Member

The deferred load splitting has issues when constants are shared among deferred chunks.

The following program illustrates the problem:

main.dart

import 'a.dart';
import 'b.dart';

main() async {
  (await doA()).method();
  await doB(); // comment out and the program works.
}

shared.dart

import 'c.dart';
const constant = const C(); // using `var` eludes the problem.

a.dart

import 'shared.dart' deferred as d;

doA() async {
  await d.loadLibrary();
  return d.constant;
}

b.dart

import 'shared.dart' deferred as d;

doB() async {
  await d.loadLibrary();
  return d.constant;
}

c.dart

class C {
  const C();
  method() => print("1");
}

This program fails with an exception when trying to call method on the first line of main. If you comment out the call to doB (hence there is no sharing), then the program runs fine.

@sigmundch sigmundch self-assigned this Nov 7, 2017
@whesse whesse closed this as completed in 747772b Jan 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant