Skip to content

Exception during generic type alias compilation #31262

@scheglov

Description

@scheglov
typedef Foo<S> = S Function<T>(T x);
class A {
  Foo<int> f;
}
scheglov@scheglov-macbookpro4:~/Source/Dart/sdk.git/sdk (master)$ pkg/front_end/tool/fasta compile /Users/scheglov/dart/test/bin/test.dart
Unhandled exception:
NoSuchMethodError: The method 'accept' was called on null.
Receiver: null
Tried calling: accept(Instance of '_InnerTypeSubstitutor')
#0      Object.noSuchMethod (dart:core-patch/dart:core/object_patch.dart:46)
#1      _TypeSubstitutor.visit (package:kernel/type_algebra.dart:389:41)
#2      _InnerTypeSubstitutor.freshTypeParameter (package:kernel/type_algebra.dart:343:19)
#3      MappedListIterable.elementAt (dart:_internal/iterable.dart:413)
#4      ListIterable.toList (dart:_internal/iterable.dart:218)
#5      _TypeSubstitutor.freshTypeParameters (package:kernel/type_algebra.dart:415:47)
#6      _TypeSubstitutor.visitFunctionType (package:kernel/type_algebra.dart:436:32)
#7      FunctionType.accept (package:kernel/ast.dart:4559:34)
#8      _TypeSubstitutor.visit (package:kernel/type_algebra.dart:389:41)
#9      Substitution.substituteType (package:kernel/type_algebra.dart:239:53)
#10     substitute (package:kernel/type_algebra.dart:19:45)
#11     KernelFunctionTypeAliasBuilder.buildTypesWithBuiltArguments (package:front_end/src/fasta/kernel/kernel_function_type_alias_builder.dart:92:12)
#12     KernelFunctionTypeAliasBuilder.buildType (package:front_end/src/fasta/kernel/kernel_function_type_alias_builder.dart:109:12)
#13     KernelNamedTypeBuilder.build (package:front_end/src/fasta/kernel/kernel_named_type_builder.dart:46:20)
#14     KernelFieldBuilder.build (package:front_end/src/fasta/kernel/kernel_field_builder.dart:70:25)
#15     SourceClassBuilder.build.buildBuilders (package:front_end/src/fasta/source/source_class_builder.dart:103:33)
#16     _HashVMBase&MapMixin&&_LinkedHashMapMixin.forEach (dart:collection-patch/dart:collection/compact_hash.dart:361)
#17     Scope.forEach (package:front_end/src/fasta/scope.dart:243:11)
#18     SourceClassBuilder.build (package:front_end/src/fasta/source/source_class_builder.dart:114:11)
#19     KernelLibraryBuilder.buildBuilder (package:front_end/src/fasta/kernel/kernel_library_builder.dart:776:21)
#20     SourceLibraryBuilder.build.<anonymous closure> (package:front_end/src/fasta/source/source_library_builder.dart:403:9)
#21     LibraryBuilder.forEach.<anonymous closure> (package:front_end/src/fasta/builder/library_builder.dart:199:10)
#22     _HashVMBase&MapMixin&&_LinkedHashMapMixin.forEach (dart:collection-patch/dart:collection/compact_hash.dart:361)
#23     Scope.forEach (package:front_end/src/fasta/scope.dart:243:11)
#24     LibraryBuilder.forEach (package:front_end/src/fasta/builder/library_builder.dart:197:11)
#25     SourceLibraryBuilder.build (package:front_end/src/fasta/source/source_library_builder.dart:401:5)
#26     KernelLibraryBuilder.build (package:front_end/src/fasta/kernel/kernel_library_builder.dart:807:16)
#27     SourceLoader.buildProgram.<anonymous closure> (package:front_end/src/fasta/source/source_loader.dart:473:31)
#28     _HashVMBase&MapMixin&&_LinkedHashMapMixin.forEach (dart:collection-patch/dart:collection/compact_hash.dart:361)
#29     SourceLoader.buildProgram (package:front_end/src/fasta/source/source_loader.dart:471:14)
#30     KernelTarget.buildOutlines (package:front_end/src/fasta/kernel/kernel_target.dart:250:14)
<asynchronous suspension>
#31     CompileTask.buildOutline (file:///Users/scheglov/Source/Dart/sdk.git/sdk/pkg/front_end/tool/_fasta/entry_points.dart:145:38)```

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions