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

Compiler Error: Invalid argument(s): Type parameter T is not indexed #41667

Closed
marktanner1331 opened this issue Apr 26, 2020 · 2 comments
Closed
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues.

Comments

@marktanner1331
Copy link

marktanner1331 commented Apr 26, 2020

Version information

Dart VM version: 2.7.0 (Fri Dec 6 16:26:51 2019 +0100) on "windows_x64"`

Code to replicate

Future main() async {
  MyClass sc = MyClass();
}

 class MyClass {
  final AwaitLock awaitLock = AwaitLock();

  Future<void> run() async {
    await awaitLock(() => Future<void>.sync(() => print("here")));
  }
}

class AwaitLock {
  Future<T> call<T>(Future<T> Function() f) async {
    return await f();
  }
}

Error

Invalid argument(s): Type parameter T is not indexed
#0      TypeParameterIndexer.[]  (package:kernel/binary/ast_to_binary.dart:2573:8)
#1      BinaryPrinter.visitTypeParameterType  (package:kernel/binary/ast_to_binary.dart:2125:38)
#2      TypeParameterType.accept  (package:kernel/ast.dart:5996:42)
#3      BinaryPrinter.writeNode  (package:kernel/binary/ast_to_binary.dart:392:10)

#4      LimitedBinaryPrinter.writeNode  (package:kernel/binary/limited_ast_to_binary.dart:59:11)
#5      BinaryPrinter.writeNodeList  (package:kernel/binary/ast_to_binary.dart:302:7)
#6      BinaryPrinter.visitArguments  (package:kernel/binary/ast_to_binary.dart:1492:5)
#7      Arguments.accept  (package:kernel/ast.dart:3158:38)
#8      BinaryPrinter.writeArgumentsNode  (package:kernel/binary/ast_to_binary.dart:406:10)
#9      BinaryPrinter.visitStaticInvocation  (package:kernel/binary/ast_to_binary.dart:1476:5)
#10     StaticInvocation.accept  (package:kernel/ast.dart:3413:44)
#11     BinaryPrinter.writeNode  (package:kernel/binary/ast_to_binary.dart:392:10)

#12     LimitedBinaryPrinter.writeNode  (package:kernel/binary/limited_ast_to_binary.dart:59:11)
#13     BinaryPrinter.visitExpressionStatement  (package:kernel/binary/ast_to_binary.dart:1791:5)
#14     ExpressionStatement.accept  (package:kernel/ast.dart:4491:43)
#15     BinaryPrinter.writeNode  (package:kernel/binary/ast_to_binary.dart:392:10)
#16     LimitedBinaryPrinter.writeNode  (package:kernel/binary/limited_ast_to_binary.dart:59:11)
#17     BinaryPrinter.writeNodeList  (package:kernel/binary/ast_to_binary.dart:302:7)
#18     BinaryPrinter.visitBlock  (package:kernel/binary/ast_to_binary.dart:1799:5)

#19     Block.accept  (package:kernel/ast.dart:4519:43)
#20     BinaryPrinter.writeNode  (package:kernel/binary/ast_to_binary.dart:392:10)
#21     LimitedBinaryPrinter.writeNode  (package:kernel/binary/limited_ast_to_binary.dart:59:11)
#22     BinaryPrinter.visitLabeledStatement  (package:kernel/binary/ast_to_binary.dart:1833:5)
#23     LabeledStatement.accept  (package:kernel/ast.dart:4633:43)
#24     BinaryPrinter.writeNode  (package:kernel/binary/ast_to_binary.dart:392:10)
#25     LimitedBinaryPrinter.writeNode  (package:kernel/binary/limited_ast_to_binary.dart:59:11)

#26     BinaryPrinter.writeNodeList  (package:kernel/binary/ast_to_binary.dart:302:7)
#27     BinaryPrinter.visitBlock  (package:kernel/binary/ast_to_binary.dart:1799:5)
#28     Block.accept  (package:kernel/ast.dart:4519:43)
#29     BinaryPrinter.writeNode  (package:kernel/binary/ast_to_binary.dart:392:10)
#30     LimitedBinaryPrinter.writeNode  (package:kernel/binary/limited_ast_to_binary.dart:59:11)
#31     BinaryPrinter.visitTryCatch  (package:kernel/binary/ast_to_binary.dart:1950:5)
#32     TryCatch.accept  (package:kernel/ast.dart:4984:43)
#33     BinaryPrinter.writeNode  (package:kernel/binary/ast_to_binary.dart:392:10)
#34     LimitedBinaryPrinter.writeNode  (package:kernel/binary/limited_ast_to_binary.dart:59:11)

#35     BinaryPrinter.writeOptionalNode  (package:kernel/binary/ast_to_binary.dart:485:7)
#36     BinaryPrinter.visitFunctionNode  (package:kernel/binary/ast_to_binary.dart:1324:5)
#37     FunctionNode.accept  (package:kernel/ast.dart:2499:38)
#38     BinaryPrinter.writeFunctionNode  (package:kernel/binary/ast_to_binary.dart:399:10)
#39     BinaryPrinter.visitFunctionDeclaration  (package:kernel/binary/ast_to_binary.dart:2026:5)
#40     FunctionDeclaration.accept  (package:kernel/ast.dart:5328:43)
#41     BinaryPrinter.writeNode  (package:kernel/binary/ast_to_binary.dart:392:10)
#42     LimitedBinaryPrinter.writeNode  (package:kernel/binary/limited_ast_to_binary.dart:59:11)
#43     BinaryPrinter.writeNodeList  (package:kernel/binary/ast_to_binary.dart:302:7)
#44     BinaryPrinter.visitBlock  (package:kernel/binary/ast_to_binary.dart:1799:5)
#45     Block.accept  (package:kernel/ast.dart:4519:43)
#46     BinaryPrinter.writeNode  (package:kernel/binary/ast_to_binary.dart:392:10)

#47     LimitedBinaryPrinter.writeNode  (package:kernel/binary/limited_ast_to_binary.dart:59:11)
#48     BinaryPrinter.writeOptionalNode  (package:kernel/binary/ast_to_binary.dart:485:7)
#49     BinaryPrinter.visitFunctionNode  (package:kernel/binary/ast_to_binary.dart:1324:5)
#50     FunctionNode.accept  (package:kernel/ast.dart:2499:38)
#51     BinaryPrinter.writeFunctionNode  (package:kernel/binary/ast_to_binary.dart:399:10)
#52     BinaryPrinter.writeOptionalFunctionNode  (package:kernel/binary/ast_to_binary.dart:494:7)
#53     BinaryPrinter.visitProcedure  (package:kernel/binary/ast_to_binary.dart:1200:5)
#54     Procedure.accept  (package:kernel/ast.dart:2140:40)
#55     BinaryPrinter.writeProcedureNode  (package:kernel/binary/ast_to_binary.dart:420:10)
#56     BinaryPrinter.writeProcedureNodeList  (package:kernel/binary/ast_to_binary.dart:311:7)
#57     BinaryPrinter.visitClass  (package:kernel/binary/ast_to_binary.dart:1128:5)
#58     Class.accept  (package:kernel/ast.dart:1218:38)
#59     BinaryPrinter.writeClassNode  (package:kernel/binary/ast_to_binary.dart:434:10)
#60     BinaryPrinter.writeClassNodeList  (package:kernel/binary/ast_to_binary.dart:329:7)
#61     BinaryPrinter.visitLibrary  (package:kernel/binary/ast_to_binary.dart:958:5)
#62     Library.accept  (package:kernel/ast.dart:532:38)
#63     BinaryPrinter.writeLibraryNode  (package:kernel/binary/ast_to_binary.dart:413:10)
#64     LimitedBinaryPrinter.writeLibraries  (package:kernel/binary/limited_ast_to_binary.dart:52:31)
#65     BinaryPrinter.writeComponentFile.<anonymous closure>  (package:kernel/binary/ast_to_binary.dart:562:7)
#66     Timeline.timeSync  (dart:developer/timeline.dart:163:22)
#67     BinaryPrinter.writeComponentFile  (package:kernel/binary/ast_to_binary.dart:546:14)
#68     serializeComponent  (package:front_end/src/fasta/kernel/utils.dart:75:11)
#69     _processLoadRequest  (file:///C:/b/s/w/ir/cache/builder/sdk/pkg/vm/bin/kernel_service.dart:724:41)
<asynchronous suspension>
#70     _RawReceivePortImpl._handleMessage  (dart:isolate-patch/isolate_patch.dart:174:12)

Remarks
This seems to be an issue with using the call method with generic arguments and await.

@mraleph
Copy link
Member

mraleph commented Apr 28, 2020

Thank you for the report @marktanner1331

Does not reproduce on master, so I presume it is fixed.

/cc @jensjoha

@mraleph mraleph closed this as completed Apr 28, 2020
@mraleph mraleph added the area-front-end Use area-front-end for front end / CFE / kernel format related issues. label Apr 28, 2020
@jensjoha
Copy link
Contributor

A bisect shows it was fixed in a9485e8.

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

3 participants