Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Using void in a generic function throws. #496

Closed
jacob314 opened this issue Apr 15, 2016 · 2 comments
Closed

Using void in a generic function throws. #496

jacob314 opened this issue Apr 15, 2016 · 2 comments

Comments

@jacob314
Copy link
Contributor

jacob314 commented Apr 15, 2016

Repro:

wrapZone/*<E, R*/(/*R*/ callback(/*E*/ evt)) {

}
wrapZone/*<Event, void>*/(someCallback)

crashes the dev compiler. It would be nice to support this case but reasonable to just report an error instead of crashing.

Unhandled exception:
Invalid argument (name): not a valid identifier: ""
#0      Identifier.Identifier (package:dev_compiler/src/js/nodes.dart:1074:7)
#1      JSCodegenVisitor.visitSimpleIdentifier (package:dev_compiler/src/codegen/js_codegen.dart:1727:45)
#2      SimpleIdentifierImpl.accept (package:analyzer/src/dart/ast/ast.dart:8971:15)
#3      JSCodegenVisitor._visit (package:dev_compiler/src/codegen/js_codegen.dart:3482:23)
#4      JSCodegenVisitor._emitSend (package:dev_compiler/src/codegen/js_codegen.dart:3062:12)
#5      JSCodegenVisitor.visitBinaryExpression (package:dev_compiler/src/codegen/js_codegen.dart:2690:12)
#6      BinaryExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:1136:15)
#7      JSCodegenVisitor._visit (package:dev_compiler/src/codegen/js_codegen.dart:3482:23)
...
@jmesserly
Copy link
Contributor

Yeah generic methods aren't implemented in DDC yet :)
Tracking bug for that #301

But I think this is unrelated, my guess is Dart Analyzer will reject this in strong mode. I'll file it over at SDK repo

@jmesserly
Copy link
Contributor

moved to dart-lang/sdk#26275

BTW I think your stack is a reasonable bug to re-file if you can figure out a repro for it. Since it crashed in visitBinaryExpression and it was due to an unnamed identifier I'm guessing it was not related to "void"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants