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

super params: Invalid argument(s): Type parameter TypeParameter(MultiRootFileSystemEntity.D) is not indexed #48708

Closed
goderbauer opened this issue Mar 30, 2022 · 6 comments
Assignees
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues.

Comments

@goderbauer
Copy link
Contributor

goderbauer commented Mar 30, 2022

After migrating flutter_tools to use super parameters, one of its tests is failing with:

00:01 +0: loading test/general.shard/project_file_invalidator_test.dart                                                                                                                                  Unhandled exception:
Invalid argument(s): Type parameter TypeParameter(MultiRootFileSystemEntity.D) is not indexed
#0      TypeParameterIndexer.[] (package:kernel/binary/ast_to_binary.dart:2927:8)
#1      BinaryPrinter.visitTypeParameterType (package:kernel/binary/ast_to_binary.dart:2432:38)
#2      TypeParameterType.accept (package:kernel/ast.dart:11915:42)
#3      BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:430:10)
#4      BinaryPrinter.writeVariableDeclaration (package:kernel/binary/ast_to_binary.dart:2271:5)
#5      BinaryPrinter.writeList (package:kernel/binary/ast_to_binary.dart:331:16)
#6      BinaryPrinter.writeVariableDeclarationList (package:kernel/binary/ast_to_binary.dart:2279:5)
#7      BinaryPrinter.visitFunctionNode (package:kernel/binary/ast_to_binary.dart:1484:5)
#8      FunctionNode.accept (package:kernel/ast.dart:3871:38)
#9      BinaryPrinter.writeFunctionNode (package:kernel/binary/ast_to_binary.dart:437:10)
#10     BinaryPrinter.visitConstructor (package:kernel/binary/ast_to_binary.dart:1254:5)
#11     Constructor.accept (package:kernel/ast.dart:2488:40)
#12     BinaryPrinter.writeConstructorNode (package:kernel/binary/ast_to_binary.dart:486:10)
#13     BinaryPrinter.writeConstructorNodeList (package:kernel/binary/ast_to_binary.dart:385:7)
#14     BinaryPrinter.visitClass (package:kernel/binary/ast_to_binary.dart:1220:5)
#15     Class.accept (package:kernel/ast.dart:1433:38)
#16     BinaryPrinter.writeClassNode (package:kernel/binary/ast_to_binary.dart:472:10)
#17     BinaryPrinter.writeClassNodeList (package:kernel/binary/ast_to_binary.dart:367:7)
#18     BinaryPrinter.visitLibrary (package:kernel/binary/ast_to_binary.dart:1058:5)
#19     Library.accept (package:kernel/ast.dart:565:38)
#20     BinaryPrinter.writeLibraryNode (package:kernel/binary/ast_to_binary.dart:451:10)
#21     BinaryPrinter.writeLibraries (package:kernel/binary/ast_to_binary.dart:756:9)
#22     BinaryPrinter.writeComponentFile.<anonymous closure> (package:kernel/binary/ast_to_binary.dart:595:7)
#23     Timeline.timeSync (dart:developer/timeline.dart:157:22)
#24     BinaryPrinter.writeComponentFile (package:kernel/binary/ast_to_binary.dart:577:14)
#25     IncrementalSerializer.serialize (package:front_end/src/fasta/incremental_serializer.dart:308:13)
#26     IncrementalSerializer.writePackagesToSinkAndTrimComponent (package:front_end/src/fasta/incremental_serializer.dart:158:24)
#27     FrontendCompiler.writeDillFile (file:///opt/s/w/ir/cache/builder/sdk/pkg/frontend_server/lib/frontend_server.dart:727:29)
#28     FrontendCompiler.compile (file:///opt/s/w/ir/cache/builder/sdk/pkg/frontend_server/lib/frontend_server.dart:604:13)
<asynchronous suspension>
#29     listenAndCompile.<anonymous closure> (file:///opt/s/w/ir/cache/builder/sdk/pkg/frontend_server/lib/frontend_server.dart:1198:11)
<asynchronous suspension>
00:01 +0 -1: loading test/general.shard/project_file_invalidator_test.dart [E]                                                                                                                           
  Failed to load "test/general.shard/project_file_invalidator_test.dart": unknown error
  SocketException: Write failed (OS Error: Broken pipe, errno = 32), port = 0
  dart:io-patch/socket_patch.dart 1190:34                                _NativeSocket.write
  dart:io-patch/socket_patch.dart 1906:15                                _RawSocket.write
  dart:io-patch/socket_patch.dart 2346:18                                _Socket._write
  dart:io-patch/socket_patch.dart 2094:26                                _SocketStreamConsumer.write
  dart:io-patch/socket_patch.dart 2068:11                                _SocketStreamConsumer.addStream.<fn>
  dart:async/zone.dart 1434:47                                           _rootRunUnary
  dart:async/zone.dart 1335:19                                           _CustomZone.runUnary
  dart:async/zone.dart 1244:7                                            _CustomZone.runUnaryGuarded
  dart:async/stream_impl.dart 341:11                                     _BufferingStreamSubscription._sendData
  dart:async/stream_impl.dart 271:7                                      _BufferingStreamSubscription._add
  dart:async/stream_controller.dart 774:19                               _SyncStreamControllerDispatch._sendData
  dart:async/stream_controller.dart 648:7                                _StreamController._add
  dart:async/stream_controller.dart 596:5                                _StreamController.add
  dart:io/io_sink.dart 136:17                                            _StreamSinkImpl.add
  dart:io/io_sink.dart 269:5                                             _IOSinkImpl.write
  dart:io/io_sink.dart 289:5                                             _IOSinkImpl.writeln
  dart:io-patch/socket_patch.dart 2186:45                                _Socket.writeln
  dart:io/stdio.dart 319:11                                              _StdSink.writeln
  package:frontend_server_client/src/frontend_server_client.dart 322:21  FrontendServerClient._sendCommand
  package:frontend_server_client/src/frontend_server_client.dart 239:5   FrontendServerClient.accept
  package:test_core/src/runner/vm/test_compiler.dart 127:30              _TestCompilerForLanguageVersion._compile
  ===== asynchronous gap ===========================
  package:pool/pool.dart 127:14                                          Pool.withResource
  ===== asynchronous gap ===========================
  package:test_core/src/runner/vm/platform.dart 173:9                    VMPlatform._spawnKernelIsolate
  ===== asynchronous gap ===========================
  package:test_core/src/runner/vm/platform.dart 56:17                    VMPlatform.load
  ===== asynchronous gap ===========================
  package:test_core/src/runner/loader.dart 224:25                        Loader.loadFile.<fn>
  ===== asynchronous gap ===========================
  package:test_core/src/runner/load_suite.dart 97:21                     new LoadSuite.<fn>.<fn>
  
00:01 +0 -1: Some tests failed.                                                                              

To reporduce:

  1. Check out Prepare flutter_tools for use_super_parameters flutter/flutter#100509
  2. cd into flutter_tools: cd packages/flutter_tools
  3. run the test: dart run test test/general.shard/project_file_invalidator_test.dart

So far I have sadly been unable to reproduce this issue on a smaller scale outside of the PR, but flutter's adaptation of super parameters is blocked on this.

@goderbauer
Copy link
Contributor Author

/cc @mit-mit @pq

@mit-mit
Copy link
Member

mit-mit commented Mar 30, 2022

@johnniwinther this also repros with:

mit-macbookpro5:flutter_tools mit$ dart compile kernel test/general.shard/project_file_invalidator_test.dart
Compiling test/general.shard/project_file_invalidator_test.dart to kernel file test/general.shard/project_file_invalidator_test.dill.
Info: Compiling without sound null safety
Invalid argument(s): Type parameter TypeParameter(MultiRootFileSystemEntity.D) is not indexed
#0      TypeParameterIndexer.[] (package:kernel/binary/ast_to_binary.dart:2927:8)
#1      BinaryPrinter.visitTypeParameterType (package:kernel/binary/ast_to_binary.dart:2432:38)
#2      TypeParameterType.accept (package:kernel/ast.dart:11915:42)
#3      BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:430:10)
...

@goderbauer
Copy link
Contributor Author

dart compile kernel lib/src/base/multi_root_file_system.dart also repros it (that's the file imported by that test that seems to be the problem)

@pq
Copy link
Member

pq commented Mar 30, 2022

cc @stereotype441

@pq
Copy link
Member

pq commented Mar 30, 2022

cc @chloestefantsova

@johnniwinther johnniwinther self-assigned this Mar 30, 2022
@johnniwinther
Copy link
Member

Small repro:

class A {}

class Mixin {}

abstract class B<D> {
  B({
    required this.field,
  });

  final D field;
}

class C extends B<A> with Mixin {
  C({
    required super.field,
  });
}

@devoncarew devoncarew added the area-front-end Use area-front-end for front end / CFE / kernel format related issues. label Mar 30, 2022
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

5 participants