Skip to content

Fasta crashes on this generic function type code #30838

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

Closed
scheglov opened this issue Sep 20, 2017 · 1 comment
Closed

Fasta crashes on this generic function type code #30838

scheglov opened this issue Sep 20, 2017 · 1 comment
Assignees
Labels
front-end-fasta legacy-area-front-end Legacy: Use area-dart-model instead.

Comments

@scheglov
Copy link
Contributor

typedef Foo<S> = S Function<T>(T x);
int foo<T>(T x) => 3;
Foo<int> bar() => foo;
void test1() {
  bar()<String>("hello");
}

class A {
  Foo<int> f;
  void test() {
    f<String>("hello");
  }
}

It work fine in Analyzer.

  NoSuchMethodError: The method 'accept' was called on null.
  Receiver: null
  Tried calling: accept(Instance of '_InnerTypeSubstitutor')
  #0      Object._noSuchMethod (dart:core-patch/object_patch.dart:42)
  #1      Object.noSuchMethod (dart:core-patch/object_patch.dart:46)
  #2      _TypeSubstitutor.visit (package:kernel/type_algebra.dart:370:41)
  #3      _InnerTypeSubstitutor.freshTypeParameter (package:kernel/type_algebra.dart:324:19)
  #4      MappedListIterable.elementAt (dart:_internal/iterable.dart:413)
  #5      ListIterable.toList (dart:_internal/iterable.dart:218)
  #6      _TypeSubstitutor.freshTypeParameters (package:kernel/type_algebra.dart:396:47)
  #7      _TypeSubstitutor.visitFunctionType (package:kernel/type_algebra.dart:417:32)
  #8      FunctionType.accept (package:kernel/ast.dart:4486:34)
  #9      _TypeSubstitutor.visit (package:kernel/type_algebra.dart:370:41)
  #10     Substitution.substituteType (package:kernel/type_algebra.dart:235:53)
  #11     substitute (package:kernel/type_algebra.dart:19:45)
  #12     KernelFunctionTypeAliasBuilder.buildTypesWithBuiltArguments (package:front_end/src/fasta/kernel/kernel_function_type_alias_builder.dart:92:12)
  #13     KernelFunctionTypeAliasBuilder.buildType (package:front_end/src/fasta/kernel/kernel_function_type_alias_builder.dart:109:12)
  #14     KernelNamedTypeBuilder.build (package:front_end/src/fasta/kernel/kernel_named_type_builder.dart:61:20)
  #15     KernelFunctionBuilder.buildFunction (package:front_end/src/fasta/kernel/kernel_procedure_builder.dart:150:38)
  #16     KernelProcedureBuilder.build (package:front_end/src/fasta/kernel/kernel_procedure_builder.dart:286:28)
  #17     KernelLibraryBuilder.buildBuilder (package:front_end/src/fasta/kernel/kernel_library_builder.dart:752:33)
  #18     SourceLibraryBuilder.build.<anonymous closure> (package:front_end/src/fasta/source/source_library_builder.dart:390:9)
  #19     _HashVMBase&MapMixin&&_LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:356)
  #20     Scope.forEach (package:front_end/src/fasta/scope.dart:243:11)
  #21     LibraryBuilder.forEach (package:front_end/src/fasta/builder/library_builder.dart:190:11)
  #22     SourceLibraryBuilder.build (package:front_end/src/fasta/source/source_library_builder.dart:388:5)
  #23     KernelLibraryBuilder.build (package:front_end/src/fasta/kernel/kernel_library_builder.dart:769:16)
  #24     SourceLoader.buildProgram.<anonymous closure> (package:front_end/src/fasta/source/source_loader.dart:456:31)
  #25     _HashVMBase&MapMixin&&_LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:356)
  #26     SourceLoader.buildProgram (package:front_end/src/fasta/source/source_loader.dart:454:14)
  #27     KernelTarget.buildOutlines (package:front_end/src/fasta/kernel/kernel_target.dart:244:14)
  <asynchronous suspension>
  #28     KernelDriver._compileCycle.<anonymous closure>.<anonymous closure> (package:front_end/src/incremental/kernel_driver.dart:258:28)
@peter-ahe-google
Copy link
Contributor

@askeksa-google is currently looking at fixing crashes in Fasta.

@peter-ahe-google peter-ahe-google removed the legacy-area-front-end Legacy: Use area-dart-model instead. label Sep 21, 2017
@sigmundch sigmundch added the legacy-area-front-end Legacy: Use area-dart-model instead. label Oct 4, 2017
@whesse whesse closed this as completed in de2ce48 Dec 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
front-end-fasta legacy-area-front-end Legacy: Use area-dart-model instead.
Projects
None yet
Development

No branches or pull requests

4 participants