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

Conditional export won't work in DDC mode only when upgrading to 2.1.1 #36029

Closed
jumperchen opened this issue Feb 26, 2019 · 2 comments
Closed
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dev-compiler

Comments

@jumperchen
Copy link

Dart version: 2.1.1 and 2.2.0-dev.2.1

The following example can reproduce this error.

  • main.dart
import 'foo.dart';

void main() {
  print(Foo().sayHi());
}
  • foo.dart
// ignore: uri_does_not_exist
export 'foo_impl.dart'
// ignore: uri_does_not_exist
if (dart.library.html) 'html_foo_impl.dart'
// ignore: uri_does_not_exist
if (dart.library.io) 'io_foo_impl.dart';
  • foo_impl.dart
class Foo {
  String sayHi() => 'foo';
}
  • html_foo_impl.dart
class Foo {
  String sayHi() => 'html_foo';
}
  • io_foo_impl.dart
class Foo {
  String sayHi() => 'io_foo';
}

And then run with the command

$ pub run build_runner serve test

The error messages:

[SEVERE] build_web_compilers|ddc on test/main.dartdevc.module (cached):
Error compiling dartdevc module:foo|test/main.ddc.js

[error] The function 'Foo' isn't defined. (/test/main.dart, line 4, col 9)

Please fix all errors before compiling (warnings are okay).
}

Note: If we run with $ pub run build_runner serve test -r or $ pub run test test/main.dart no error at all.

@jumperchen
Copy link
Author

FYI: won't work starting from 2.1.1-dev.0.0

@lrhn lrhn added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dev-compiler labels Feb 26, 2019
@natebosch
Copy link
Member

I think this is a duplicate of #34179

Please track that issue for updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dev-compiler
Projects
None yet
Development

No branches or pull requests

3 participants