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

The front end is not happy about wrong extension type constructor declaration #55649

Open
eernstg opened this issue May 6, 2024 · 0 comments
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. cfe-crashes Crashes in the CFE type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@eernstg
Copy link
Member

eernstg commented May 6, 2024

Note that this failure is similar to the one which is reported in #55648, but the stack dump is quite different.

Consider the following program:

class _A<X> { const _A(); }

extension type const A<X>._(_A<X> _) implements _A<X> {
  const A<X>(): this._(_A<X>());
}

void main() {}

This program is rejected (rightfully) by the analyzer, but it causes the common front end to incur a dynamic type error.

Stack dump
Invalid argument(s): Iterables do not have same length.
#0      MapBase._fillMapWithIterables (dart:collection/maps.dart:178:7)
#1      new LinkedHashMap.fromIterables (dart:collection/linked_hash_map.dart:246:13)
#2      Substitution.fromPairs (package:kernel/type_algebra.dart:477:13)
#3      ExtensionType._computeTypeErasure (package:kernel/ast.dart:12099:36)
#4      ExtensionType.extensionTypeErasure (package:kernel/ast.dart:12043:40)
#5      BinaryPrinter.visitExtensionType (package:kernel/binary/ast_to_binary.dart:2493:20)
#6      ExtensionType.accept (package:kernel/ast.dart:12123:14)
#7      BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:441:10)
#8      BinaryPrinter.visitFunctionNode (package:kernel/binary/ast_to_binary.dart:1528:5)
#9      FunctionNode.accept (package:kernel/ast.dart:3904:38)
#10     BinaryPrinter.writeFunctionNode (package:kernel/binary/ast_to_binary.dart:448:10)
#11     BinaryPrinter.visitProcedure (package:kernel/binary/ast_to_binary.dart:1379:5)
#12     Procedure.accept (package:kernel/ast.dart:3261:40)
#13     BinaryPrinter.writeProcedureNode (package:kernel/binary/ast_to_binary.dart:469:10)
#14     BinaryPrinter.writeProcedureNodeList (package:kernel/binary/ast_to_binary.dart:360:7)
#15     BinaryPrinter.visitLibrary (package:kernel/binary/ast_to_binary.dart:1124:5)
#16     Library.accept (package:kernel/ast.dart:597:38)
#17     BinaryPrinter.writeLibraryNode (package:kernel/binary/ast_to_binary.dart:462:10)
#18     BinaryPrinter.writeLibraries (package:kernel/binary/ast_to_binary.dart:797:9)
#19     BinaryPrinter.writeComponentFile.<anonymous closure> (package:kernel/binary/ast_to_binary.dart:607:7)
#20     Timeline.timeSync (dart:developer/timeline.dart:173:22)
#21     BinaryPrinter.writeComponentFile (package:kernel/binary/ast_to_binary.dart:588:14)
#22     serializeComponent (file:///b/f/w/pkg/vm/bin/kernel_service.dart:1031:11)
#23     _processLoadRequest (file:///b/f/w/pkg/vm/bin/kernel_service.dart:931:13)
<asynchronous suspension>
@eernstg eernstg added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) area-front-end Use area-front-end for front end / CFE / kernel format related issues. labels May 6, 2024
@eernstg eernstg changed the title The front end is not happy about wrong constructor declaration The front end is not happy about wrong extension type constructor declaration May 6, 2024
@johnniwinther johnniwinther added the cfe-crashes Crashes in the CFE label May 7, 2024
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. cfe-crashes Crashes in the CFE type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

2 participants