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

Dart crashes on incorrect generic class declaration instead of throwing compile error #36946

Open
iarkh opened this issue May 13, 2019 · 0 comments
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues.

Comments

@iarkh
Copy link
Contributor

iarkh commented May 13, 2019

Dart SDK Version: 2.3.1-dev.0.0
OS: Windows 10 64 bit

Dart crashes on the following code example instead of throwing compile time error:

class A<X> {}
class test<X extends num> = A<X>;
main() {}

Analyzer is OK with this.

Please note that dart throws expected error if I change test class declaration to class test<X> = A<X>.

It's not reproducible with dart 2.0 for me (tested 2.0.0-dev.69.5) and is reproducibel with dart 2.2.0 (tested 2.2.0-dev.2.1).

Crashing sample output is:

$> dart test.dart
Crash when compiling null,
at character offset null:
NoSuchMethodError: The method 'buildType' was called on null.
Receiver: null
Tried calling: buildType(Instance of 'KernelLibraryBuilder', null)
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:50:5)
#1 KernelNamedTypeBuilder.build (package:front_end/src/fasta/kernel/kernel_named_type_builder.dart:57:24)
#2 KernelTypeVariableBuilder.finish (package:front_end/src/fasta/kernel/kernel_type_variable_builder.dart:86:32)
#3 KernelLibraryBuilder.finishTypeVariables (package:front_end/src/fasta/kernel/kernel_library_builder.dart:1247:15)
#4 SourceLoader.finishTypeVariables. (package:front_end/src/fasta/source/source_loader.dart:501:26)
#5 __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:367:8)
#6 SourceLoader.finishTypeVariables (package:front_end/src/fasta/source/source_loader.dart:499:14)
#7 KernelTarget.buildOutlines. (package:front_end/src/fasta/kernel/kernel_target.dart:262:14)

#8 withCrashReporting (package:front_end/src/fasta/crash.dart:122:24)

#9 KernelTarget.buildOutlines (package:front_end/src/fasta/kernel/kernel_target.dart:249:12)

#10 IncrementalCompiler.computeDelta. (package:front_end/src/fasta/incremental_compiler.dart:299:52)

#11 CompilerContext.runInContext.. (package:front_end/src/fasta/compiler_context.dart:122:46)
#12 new Future.sync (dart:async/future.dart:224:31)
#13 CompilerContext.runInContext. (package:front_end/src/fasta/compiler_context.dart:122:19)
#14 _rootRun (dart:async/zone.dart:1124:13)
#15 _CustomZone.run (dart:async/zone.dart:1021:19)
#16 _runZoned (dart:async/zone.dart:1516:10)
#17 runZoned (dart:async/zone.dart:1463:12)
#18 CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:121:12)
#19 IncrementalCompiler.computeDelta (package:front_end/src/fasta/incremental_compiler.dart:127:20)

#20 IncrementalCompiler.compile (package:vm/incremental_compiler.dart:48:44)

#21 IncrementalCompilerWrapper.compileInternal (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/vm/bin/kernel_service.dart:216:28)

#22 Compiler.compile. (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/vm/bin/kernel_service.dart:144:31)

#23 new Future. (dart:async/future.dart:176:37)
#24 _rootRun (dart:async/zone.dart:1120:38)
#25 _CustomZone.run (dart:async/zone.dart:1021:19)
#26 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#27 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:963:23)
#28 _rootRun (dart:async/zone.dart:1124:13)
#29 _CustomZone.run (dart:async/zone.dart:1021:19)
#30 _CustomZone.bindCallback. (dart:async/zone.dart:947:23)
#31 Timer._createTimer. (dart:async-patch/timer_patch.dart:21:15)
#32 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:382:19)
#33 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:416:5)
#34 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:171:12)

#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:50:5)
#1 KernelNamedTypeBuilder.build (package:front_end/src/fasta/kernel/kernel_named_type_builder.dart:57:24)
#2 KernelTypeVariableBuilder.finish (package:front_end/src/fasta/kernel/kernel_type_variable_builder.dart:86:32)
#3 KernelLibraryBuilder.finishTypeVariables (package:front_end/src/fasta/kernel/kernel_library_builder.dart:1247:15)
#4 SourceLoader.finishTypeVariables. (package:front_end/src/fasta/source/source_loader.dart:501:26)
#5 __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:367:8)
#6 SourceLoader.finishTypeVariables (package:front_end/src/fasta/source/source_loader.dart:499:14)
#7 KernelTarget.buildOutlines. (package:front_end/src/fasta/kernel/kernel_target.dart:262:14)

#8 withCrashReporting (package:front_end/src/fasta/crash.dart:122:24)

#9 KernelTarget.buildOutlines (package:front_end/src/fasta/kernel/kernel_target.dart:249:12)

#10 IncrementalCompiler.computeDelta. (package:front_end/src/fasta/incremental_compiler.dart:299:52)

#11 CompilerContext.runInContext.. (package:front_end/src/fasta/compiler_context.dart:122:46)
#12 new Future.sync (dart:async/future.dart:224:31)
#13 CompilerContext.runInContext. (package:front_end/src/fasta/compiler_context.dart:122:19)
#14 _rootRun (dart:async/zone.dart:1124:13)
#15 _CustomZone.run (dart:async/zone.dart:1021:19)
#16 _runZoned (dart:async/zone.dart:1516:10)
#17 runZoned (dart:async/zone.dart:1463:12)
#18 CompilerContext.runInContext (package:front_end/src/fasta/compiler_context.dart:121:12)
#19 IncrementalCompiler.computeDelta (package:front_end/src/fasta/incremental_compiler.dart:127:20)

#20 IncrementalCompiler.compile (package:vm/incremental_compiler.dart:48:44)

#21 IncrementalCompilerWrapper.compileInternal (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/vm/bin/kernel_service.dart:216:28)

#22 Compiler.compile. (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/vm/bin/kernel_service.dart:144:31)

#23 new Future. (dart:async/future.dart:176:37)
#24 _rootRun (dart:async/zone.dart:1120:38)
#25 _CustomZone.run (dart:async/zone.dart:1021:19)
#26 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#27 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:963:23)
#28 _rootRun (dart:async/zone.dart:1124:13)
#29 _CustomZone.run (dart:async/zone.dart:1021:19)
#30 _CustomZone.bindCallback. (dart:async/zone.dart:947:23)
#31 Timer._createTimer. (dart:async-patch/timer_patch.dart:21:15)
#32 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:382:19)
#33 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:416:5)
#34 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:171:12)

@mit-mit mit-mit added the area-front-end Use area-front-end for front end / CFE / kernel format related issues. label May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues.
Projects
None yet
Development

No branches or pull requests

2 participants