-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Greencat library usage crashes the compiler #28749
Comments
You seem to be using https://github.com/dart-lang/compiler_unsupported have you tried with stable dart2js? |
@alexeieleusis thanks for that info, I never saw that it printed compiler_unsupported! I wonder how that gets pulled in, I am using dart_to_js_script_rewriter: ^1.0.1 which I thought would be fine. Researching that now. |
Hmm everything is now ported to the latest version. For completeness. This is my pubspec.yaml. Anything wrong with it that would pull in the unsupported compiler?
|
@sturmf - you can ignore the If you are really curious, you can confirm this by excluding dart2js from pub-build and running dart2js manually (e.g. by adding a transformer that skips dart2js:
), running @rakudrama - looks like an issue related to our RTI encoding |
Can you attach test/event_list_test.dart.browser_test.dart ? |
Hmm I didn't figure out how to attach a file so here it is inline:
And this is the way I run it. Call pub serve in one terminal and pub run test -p dartium --pub-serve=8081 The source is also available here: https://github.com/sturmf/regatta-angular2/blob/REG-51-switch-to-redux-arc/frontend/test/event_list_test.dart |
shouldn't the |
@sigmundch Hmm I tried to create the transpiled file. But since it only gets created during the test run I didn't manage to get hold of it. Any ideas how I could get at it? What would the pubspec look like and do I do pub serve --mode debug or more? |
Mmm - good question, not sure, is the error above something you see in your pub-serve terminal or in your pub-run-test terminal? If it is in the pub-serve terminal, then here is what you can do:
name: frontend
version: 0.0.1
description: Regatta frontend
author:
homepage: https://regatta.atlassian.net
documentation:
environment:
sdk: '>=1.19.0 <2.0.0'
dependencies:
angular2: 3.0.0-alpha
angular2_components: 0.3.1-alpha
reflectable: 1.0.1
sass_transformer: 0.1.2+1
greencat: 0.0.2
browser: 0.10.0+2
http: 0.11.3+9
stream_transformers: 0.3.0+3
dev_dependencies:
test: 0.12.19
dart_to_js_script_rewriter: 1.0.2
dart_style: 0.2.16
pageloader: 2.2.5
mockito: 1.0.1
angular_test: 1.0.0-alpha+5
transformers:
- angular2/transform/codegen:
platform_directives:
- 'package:angular2/common.dart#COMMON_DIRECTIVES'
platform_pipes:
- 'package:angular2/common.dart#COMMON_PIPES'
entry_points: web/main.dart
resolved_identifiers:
BrowserClient: 'package:http/browser_client.dart'
Client: 'package:http/http.dart'
- angular2/transform/reflection_remover:
$include:
- test/**_test.dart
- web/main.dart
#- reflectable:
# entry_points:
# - web/main.dart
# formatted: true
- test/pub_serve:
$include: test/**_test.dart
- dart_to_js_script_rewriter
- sass_transformer
### extra transformer to skip dart2js:
- $dart2js:
$include: [] # nothing goes through dart2js
### Instead of calling pub-serve, you can call pub-build in debug mode on the
You should be able to see the file in
|
Ok - turns out we can reproduce this even if we compile the test without running any transformers. It might be somethign that only comes up because of the use of Here is a repro with your current project - I yet have to reduce this further to a simple test case: git clone git@github.com:sturmf/regatta-angular2.git
pub get
dart2js test/event_list_test.dart |
@rakudrama - here is a simpler repro, it still pulls the pubspec.yaml: name: repro
dependencies:
greencat: any a.dart: import 'dart:mirrors';
import 'package:greencat/greencat.dart';
void main() {
reflectClass(Store);
} repro: pub get
dart2js a.dart |
And here is a standalone repro, with no dependencies: import 'dart:mirrors';
typedef void F<T>(T value);
typedef F<T> Converter<T>(F<T> function);
typedef Converter<T> ConvertFactory<T>(int input);
class B<T> {
final field = <ConvertFactory<T>>[];
}
void main() {
reflectClass(B);
} |
Standalone repro without mirrors: typedef void F<T>(T value);
typedef F<U> Converter<U>(F<U> function);
typedef Converter<V> ConvertFactory<V>(int input);
class B<W> {
final field = <ConvertFactory<W>>[];
B(){return;return;}
}
void main() {
print(new B<int>().field.runtimeType);
} The crash is because the type parameter for the list allocation, e.g. if I change
I see two ways to fix dart2js at this point:
I'm inclined to start with the second option, since kernel does not contain typedef nodes. @asgerf dartk fully expands the typedefs, a potentially exponential operation. What is the plan for kernel for handling type terms that are DAGs? The dartk printout for the above program duplicates the inner function type, but is it not clear of this real duplication or a shared structure printed twice. For optimization, we want to do type algebra without the exponential expansion. |
@rakudrama I've written up all the boilerplate for typedefs in kernel, but the frontend and backend work is not done. It will probably land next week. |
The type Map<T, Foo<Set<T>>> contains one type variable referenced twice, so there are two inputs into the HTypeInfoExpression instruction. If Foo is a typedef, T can be reused, e.g. typedef E Foo<E>(E a, E b); As the typedef is expanded (to Function(Set<T>, Set<T>) => Set<T>) it should not consume additional types from the to-level input. We prevent this by capturing the types and using the captured type expressions inside the typedef expansion. TODO: We should make the type subexpression Foo<...> be a second HTypeInfoExpression, with Set<T> as its input (a third HTypeInfoExpression). This would share all the Set<T> subexpressions instead of duplicating them. This would require HTypeInfoExpression inputs to correspond to type variables AND typedefs. BUG= #28749 R=efortuna@google.com Review-Url: https://codereview.chromium.org/2812393003 .
Fixed via d15da7d |
Hi, it seems I can no longer use https://github.com/alexeieleusis/greencat/ with dart, the compiler crashes when I use it. Right now I am not sure if it is the compiler at fault or if it trips on some problematic code.
Here is my code which produces the error: https://github.com/sturmf/regatta-angular2/tree/REG-51-switch-to-redux-arc
My dart SDK version is Dart VM version: 1.21.1 on Ubuntu Linux 16.04.
The compiler crashed when compiling this element.
Store.createStore(Reducer<S, A> reducer, {S initialState, Function enhancer})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The compiler is broken.
When compiling the above element, the compiler crashed. It is not
possible to tell if this is caused by a problem in your program or
not. Regardless, the compiler should not crash.
The Dart team would greatly appreciate if you would take a moment to
report this problem at http://dartbug.com/new.
Please include the following information:
the name and version of your operating system,
the Dart SDK build number (build number could not be determined), and
the entire message you see here (including the full stack trace
below as well as the source location above).
Build error:
Transform Dart2JS on frontend|test/event_list_test.dart.browser_test.dart threw error: RangeError (index): Invalid value: Not in range 0..2, inclusive: 3
dart:core List.[]
package:compiler_unsupported/src/ssa/codegen.dart 2995 SsaCodeGenerator.visitTypeInfoExpression.
package:compiler_unsupported/src/js_backend/runtime_types.dart 801 TypeRepresentationGenerator.visitTypeVariableType
package:compiler_unsupported/src/dart_types.dart 233 TypeVariableType.accept
package:compiler_unsupported/src/js_backend/runtime_types.dart 798 TypeRepresentationGenerator.visit
package:compiler_unsupported/src/js_backend/runtime_types.dart 819 TypeRepresentationGenerator.visitList
package:compiler_unsupported/src/js_backend/runtime_types.dart 810 TypeRepresentationGenerator.visitInterfaceType
package:compiler_unsupported/src/dart_types.dart 552 InterfaceType.accept
package:compiler_unsupported/src/js_backend/runtime_types.dart 798 TypeRepresentationGenerator.visit
package:compiler_unsupported/src/js_backend/runtime_types.dart 819 TypeRepresentationGenerator.visitList
package:compiler_unsupported/src/js_backend/runtime_types.dart 861 TypeRepresentationGenerator.visitFunctionType
package:compiler_unsupported/src/dart_types.dart 730 FunctionType.accept
package:compiler_unsupported/src/js_backend/runtime_types.dart 798 TypeRepresentationGenerator.visit
package:compiler_unsupported/src/js_backend/runtime_types.dart 787 TypeRepresentationGenerator.getTypeRepresentation
package:compiler_unsupported/src/js_backend/runtime_types.dart 612 _RuntimeTypesEncoder.getTypeRepresentation
package:compiler_unsupported/src/ssa/codegen.dart 2994 SsaCodeGenerator.visitTypeInfoExpression
package:compiler_unsupported/src/ssa/nodes.dart 3365 HTypeInfoExpression.accept
package:compiler_unsupported/src/ssa/codegen.dart 661 SsaCodeGenerator.visit
package:compiler_unsupported/src/ssa/codegen.dart 667 SsaCodeGenerator.visitExpression
package:compiler_unsupported/src/ssa/codegen.dart 648 SsaCodeGenerator.use
package:compiler_unsupported/src/ssa/codegen.dart 2987 SsaCodeGenerator.visitTypeInfoExpression
package:compiler_unsupported/src/ssa/nodes.dart 3365 HTypeInfoExpression.accept
package:compiler_unsupported/src/ssa/codegen.dart 661 SsaCodeGenerator.visit
package:compiler_unsupported/src/ssa/codegen.dart 667 SsaCodeGenerator.visitExpression
package:compiler_unsupported/src/ssa/codegen.dart 648 SsaCodeGenerator.use
package:compiler_unsupported/src/ssa/codegen.dart 538 SsaCodeGenerator.visitArguments
package:compiler_unsupported/src/ssa/codegen.dart 1827 SsaCodeGenerator.visitInvokeStatic
package:compiler_unsupported/src/ssa/nodes.dart 1667 HInvokeStatic.accept
package:compiler_unsupported/src/ssa/codegen.dart 661 SsaCodeGenerator.visit
package:compiler_unsupported/src/ssa/codegen.dart 667 SsaCodeGenerator.visitExpression
package:compiler_unsupported/src/ssa/codegen.dart 633 SsaCodeGenerator.define
package:compiler_unsupported/src/ssa/codegen.dart 1287 SsaCodeGenerator.iterateBasicBlock
package:compiler_unsupported/src/ssa/codegen.dart 1177 SsaCodeGenerator.visitBasicBlock
package:compiler_unsupported/src/ssa/codegen.dart 1434 SsaCodeGenerator.visitGoto
package:compiler_unsupported/src/ssa/nodes.dart 2181 HGoto.accept
package:compiler_unsupported/src/ssa/codegen.dart 661 SsaCodeGenerator.visit
package:compiler_unsupported/src/ssa/codegen.dart 1292 SsaCodeGenerator.iterateBasicBlock
package:compiler_unsupported/src/ssa/codegen.dart 1177 SsaCodeGenerator.visitBasicBlock
package:compiler_unsupported/src/ssa/codegen.dart 375 SsaCodeGenerator.visitGraph
package:compiler_unsupported/src/ssa/codegen.dart 90 SsaCodeGeneratorTask.generateMethod.
package:compiler_unsupported/src/common/tasks.dart 63 CompilerTask.measure
package:compiler_unsupported/src/ssa/codegen.dart 84 SsaCodeGeneratorTask.generateMethod
package:compiler_unsupported/src/ssa/codegen.dart 66 SsaCodeGeneratorTask.generateCode
package:compiler_unsupported/src/ssa/ssa.dart 43 SsaFunctionCompiler.compile
package:compiler_unsupported/src/js_backend/backend.dart 1548 JavaScriptBackend.codegen
package:compiler_unsupported/src/common/codegen.dart 243 CodegenWorkItem.run
package:compiler_unsupported/src/compiler.dart 866 Compiler.emptyQueue.....
package:compiler_unsupported/src/common/tasks.dart 176 CompilerTask.measureSubtask
package:compiler_unsupported/src/compiler.dart 866 Compiler.emptyQueue....
package:compiler_unsupported/src/common/tasks.dart 176 CompilerTask.measureSubtask
package:compiler_unsupported/src/compiler.dart 864 Compiler.emptyQueue...
package:compiler_unsupported/src/compiler.dart 1623 CompilerDiagnosticReporter.withCurrentElement
package:compiler_unsupported/src/compiler.dart 862 Compiler.emptyQueue..
package:compiler_unsupported/src/enqueue.dart 749 EnqueuerStrategy.processWorkItem
package:compiler_unsupported/src/js_backend/enqueuer.dart 452 CodegenEnqueuer.forEach
package:compiler_unsupported/src/compiler.dart 858 Compiler.emptyQueue.
package:compiler_unsupported/src/common/tasks.dart 176 CompilerTask.measureSubtask
package:compiler_unsupported/src/compiler.dart 857 Compiler.emptyQueue
package:compiler_unsupported/src/compiler.dart 886 Compiler.processQueue.
package:compiler_unsupported/src/common/tasks.dart 176 CompilerTask.measureSubtask
package:compiler_unsupported/src/compiler.dart 875 Compiler.processQueue
package:compiler_unsupported/src/compiler.dart 757 Compiler.compileLoadedLibraries.
package:compiler_unsupported/src/common/tasks.dart 176 CompilerTask.measureSubtask
package:compiler_unsupported/src/compiler.dart 646 Compiler.compileLoadedLibraries
package:compiler_unsupported/src/compiler.dart 554 Compiler.runInternal.
Build completed with 2 errors.
The text was updated successfully, but these errors were encountered: