-
Couldn't load subscription status.
- Fork 1.7k
Closed
Labels
area-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.
Description
The crash is caused by this line of code: final list = toObjCObject(['abc', obj]);. See below for the full stack trace.
I tried a few experiments:
- Replacing the call to
toObjCObjectwith a call toprintstill crashes. - Adding an explicit type param to the list literal,
<Object>['abc', obj]fixes the crash. - Replacing
objwith an inlineNSObject()still crashes, but replacing it withObject()fixes the crash.NSObjectis an extension type. - Trying to remove all the other tests from the file fixes the crash, so unfortunately I haven't been able to create a minimal repro.
So it seems to be something to do with trying to infer the type of the list literal, when one of the elements is an extension type.
Dart SDK version: 3.9.2 (stable)
Full crash stack trace:
liama@liama-mac ~/d/n/p/objective_c ((3ba9a109))> dart test/converter_test.dart
Crash when compiling file:///Users/liama/dev/native/pkgs/objective_c/test/converter_test.dart at character offset 425:
RangeError (length): Invalid value: Not in inclusive range 0..1: 2
#0 List.[] (dart:core-patch/growable_array.dart)
#1 ClosedWorldClassHierarchy._getLegacyLeastUpperBoundInternal (package:kernel/class_hierarchy.dart:878:37)
#2 ClosedWorldClassHierarchy.getLegacyLeastUpperBoundFromSupertypeLists (package:kernel/class_hierarchy.dart:984:12)
#3 StandardBounds._getLegacyLeastUpperBound (package:kernel/src/standard_bounds.dart:938:24)
#4 StandardBounds.getStandardUpperBoundInternal (package:kernel/src/standard_bounds.dart:830:18)
#5 TypeSchemaStandardBounds.getStandardUpperBoundInternal (package:front_end/src/type_inference/standard_bounds.dart:42:18)
#6 StandardBounds._getStandardUpperBound (package:kernel/src/standard_bounds.dart:542:12)
#7 StandardBounds.getStandardUpperBound (package:kernel/src/standard_bounds.dart:535:12)
#8 OperationsCfe.lubInternal (package:front_end/src/type_inference/type_inference_engine.dart:766:28)
#9 TypeAnalyzerOperationsMixin.typeSchemaLub (package:_fe_analyzer_shared/src/type_inference/type_analyzer_operations.dart:1059:7)
#10 MergedTypeConstraint.mergeInTypeSchemaLower (package:_fe_analyzer_shared/src/type_inference/type_constraint.dart:160:36)
#11 MergedTypeConstraint.mergeIn (package:_fe_analyzer_shared/src/type_inference/type_constraint.dart:148:7)
#12 TypeConstraintGatherer.computeConstraints (package:front_end/src/type_inference/type_constraint_gatherer.dart:195:12)
#13 TypeSchemaEnvironment._chooseTypes (package:front_end/src/type_inference/type_schema_environment.dart:426:18)
#14 TypeSchemaEnvironment.chooseFinalTypes (package:front_end/src/type_inference/type_schema_environment.dart:409:7)
#15 InferenceVisitorImpl.visitListLiteral (package:front_end/src/type_inference/inference_visitor.dart:2865:45)
#16 ListLiteral.accept1 (package:kernel/src/ast/expressions.dart:4166:9)
#17 InferenceVisitorImpl._inferExpression (package:front_end/src/type_inference/inference_visitor.dart:291:27)
#18 InferenceVisitorImpl.inferExpression (package:front_end/src/type_inference/inference_visitor.dart:329:40)
#19 InferenceVisitorBase._inferInvocation.inferArgument (package:front_end/src/type_inference/inference_visitor_base.dart:1961:22)
#20 InferenceVisitorBase._inferInvocation (package:front_end/src/type_inference/inference_visitor_base.dart:2026:44)
#21 InferenceVisitorBase.inferInvocation (package:front_end/src/type_inference/inference_visitor_base.dart:1665:12)
#22 InferenceVisitorImpl.visitStaticInvocation (package:front_end/src/type_inference/inference_visitor.dart:8715:40)
#23 StaticInvocation.accept1 (package:kernel/src/ast/expressions.dart:2606:9)
#24 InferenceVisitorImpl._inferExpression (package:front_end/src/type_inference/inference_visitor.dart:291:27)
#25 InferenceVisitorImpl.inferExpression (package:front_end/src/type_inference/inference_visitor.dart:329:40)
#26 InferenceVisitorImpl.visitVariableDeclaration (package:front_end/src/type_inference/inference_visitor.dart:9307:11)
#27 VariableDeclaration.accept (package:kernel/src/ast/statements.dart:1704:43)
#28 InferenceVisitorImpl.inferStatement (package:front_end/src/type_inference/inference_visitor.dart:274:26)
#29 InferenceVisitorImpl._visitStatements (package:front_end/src/type_inference/inference_visitor.dart:913:50)
#30 InferenceVisitorImpl.visitBlock (package:front_end/src/type_inference/inference_visitor.dart:934:31)
#31 Block.accept (package:kernel/src/ast/statements.dart:103:43)
#32 InferenceVisitorImpl.inferStatement (package:front_end/src/type_inference/inference_visitor.dart:274:26)
#33 InferenceVisitorBase.inferLocalFunction (package:front_end/src/type_inference/inference_visitor_base.dart:2607:51)
#34 InferenceVisitorImpl.visitFunctionNode (package:front_end/src/type_inference/inference_visitor.dart:1963:12)
#35 InferenceVisitorImpl.visitFunctionExpression (package:front_end/src/type_inference/inference_visitor.dart:2001:9)
#36 FunctionExpression.accept1 (package:kernel/src/ast/expressions.dart:4612:9)
#37 InferenceVisitorImpl._inferExpression (package:front_end/src/type_inference/inference_visitor.dart:291:27)
#38 InferenceVisitorImpl.inferExpression (package:front_end/src/type_inference/inference_visitor.dart:329:40)
#39 InferenceVisitorBase._inferInvocation.inferArgument (package:front_end/src/type_inference/inference_visitor_base.dart:1961:22)
#40 InferenceVisitorBase._inferInvocation (package:front_end/src/type_inference/inference_visitor_base.dart:2085:46)
#41 InferenceVisitorBase.inferInvocation (package:front_end/src/type_inference/inference_visitor_base.dart:1665:12)
#42 InferenceVisitorImpl.visitStaticInvocation (package:front_end/src/type_inference/inference_visitor.dart:8715:40)
#43 StaticInvocation.accept1 (package:kernel/src/ast/expressions.dart:2606:9)
#44 InferenceVisitorImpl._inferExpression (package:front_end/src/type_inference/inference_visitor.dart:291:27)
#45 InferenceVisitorImpl.inferExpression (package:front_end/src/type_inference/inference_visitor.dart:329:40)
#46 InferenceVisitorImpl.visitExpressionStatement (package:front_end/src/type_inference/inference_visitor.dart:1396:40)
#47 ExpressionStatement.accept (package:kernel/src/ast/statements.dart:50:43)
#48 InferenceVisitorImpl.inferStatement (package:front_end/src/type_inference/inference_visitor.dart:274:26)
#49 InferenceVisitorImpl._visitStatements (package:front_end/src/type_inference/inference_visitor.dart:913:50)
#50 InferenceVisitorImpl.visitBlock (package:front_end/src/type_inference/inference_visitor.dart:934:31)
#51 Block.accept (package:kernel/src/ast/statements.dart:103:43)
#52 InferenceVisitorImpl.inferStatement (package:front_end/src/type_inference/inference_visitor.dart:274:26)
#53 InferenceVisitorBase.inferLocalFunction (package:front_end/src/type_inference/inference_visitor_base.dart:2607:51)
#54 InferenceVisitorImpl.visitFunctionNode (package:front_end/src/type_inference/inference_visitor.dart:1963:12)
#55 InferenceVisitorImpl.visitFunctionExpression (package:front_end/src/type_inference/inference_visitor.dart:2001:9)
#56 FunctionExpression.accept1 (package:kernel/src/ast/expressions.dart:4612:9)
#57 InferenceVisitorImpl._inferExpression (package:front_end/src/type_inference/inference_visitor.dart:291:27)
#58 InferenceVisitorImpl.inferExpression (package:front_end/src/type_inference/inference_visitor.dart:329:40)
#59 InferenceVisitorBase._inferInvocation.inferArgument (package:front_end/src/type_inference/inference_visitor_base.dart:1961:22)
#60 InferenceVisitorBase._inferInvocation (package:front_end/src/type_inference/inference_visitor_base.dart:2085:46)
#61 InferenceVisitorBase.inferInvocation (package:front_end/src/type_inference/inference_visitor_base.dart:1665:12)
#62 InferenceVisitorImpl.visitStaticInvocation (package:front_end/src/type_inference/inference_visitor.dart:8715:40)
#63 StaticInvocation.accept1 (package:kernel/src/ast/expressions.dart:2606:9)
#64 InferenceVisitorImpl._inferExpression (package:front_end/src/type_inference/inference_visitor.dart:291:27)
#65 InferenceVisitorImpl.inferExpression (package:front_end/src/type_inference/inference_visitor.dart:329:40)
#66 InferenceVisitorImpl.visitExpressionStatement (package:front_end/src/type_inference/inference_visitor.dart:1396:40)
#67 ExpressionStatement.accept (package:kernel/src/ast/statements.dart:50:43)
#68 InferenceVisitorImpl.inferStatement (package:front_end/src/type_inference/inference_visitor.dart:274:26)
#69 InferenceVisitorImpl._visitStatements (package:front_end/src/type_inference/inference_visitor.dart:913:50)
#70 InferenceVisitorImpl.visitBlock (package:front_end/src/type_inference/inference_visitor.dart:934:31)
#71 Block.accept (package:kernel/src/ast/statements.dart:103:43)
#72 InferenceVisitorImpl.inferStatement (package:front_end/src/type_inference/inference_visitor.dart:274:26)
#73 TypeInferrerImpl.inferFunctionBody (package:front_end/src/type_inference/type_inferrer.dart:197:17)
#74 BodyBuilder.finishFunction (package:front_end/src/kernel/body_builder.dart:1262:43)
#75 DietListener.buildFunctionBody (package:front_end/src/source/diet_listener.dart:1287:19)
#76 DietListener.endTopLevelMethod (package:front_end/src/source/diet_listener.dart:383:7)
#77 Parser.parseTopLevelMethod (package:_fe_analyzer_shared/src/parser/parser_impl.dart:4304:14)
#78 Parser.parseTopLevelMemberImpl (package:_fe_analyzer_shared/src/parser/parser_impl.dart:3996:14)
#79 Parser.parseTopLevelDeclarationImpl (package:_fe_analyzer_shared/src/parser/parser_impl.dart:626:14)
#80 Parser.parseUnit (package:_fe_analyzer_shared/src/parser/parser_impl.dart:411:15)
#81 SourceLoader.buildBody (package:front_end/src/source/source_loader.dart:1236:12)
<asynchronous suspension>
#82 SourceLoader.buildBodies (package:front_end/src/source/source_loader.dart:769:7)
<asynchronous suspension>
#83 KernelTarget.buildComponent.<anonymous closure> (package:front_end/src/kernel/kernel_target.dart:653:7)
<asynchronous suspension>
#84 withCrashReporting (package:front_end/src/base/crash.dart:139:12)
<asynchronous suspension>
#85 KernelTarget.buildComponent (package:front_end/src/kernel/kernel_target.dart:647:12)
<asynchronous suspension>
#86 _buildInternal (package:front_end/src/kernel_generator_impl.dart:209:19)
<asynchronous suspension>
#87 withCrashReporting (package:front_end/src/base/crash.dart:139:12)
<asynchronous suspension>
#88 generateKernel.<anonymous closure> (package:front_end/src/kernel_generator_impl.dart:45:12)
<asynchronous suspension>
#89 CompilerContext.clear (package:front_end/src/base/compiler_context.dart:77:3)
<asynchronous suspension>
#90 generateKernel (package:front_end/src/kernel_generator_impl.dart:43:10)
<asynchronous suspension>
#91 kernelForModule (package:front_end/src/api_prototype/kernel_generator.dart:107:11)
<asynchronous suspension>
#92 SingleShotCompilerWrapper.compileInternal (file:///Volumes/Work/s/w/ir/x/w/sdk/pkg/vm/bin/kernel_service.dart:464:15)
<asynchronous suspension>
#93 Compiler.compile.<anonymous closure> (file:///Volumes/Work/s/w/ir/x/w/sdk/pkg/vm/bin/kernel_service.dart:237:45)
<asynchronous suspension>
#94 _processLoadRequest (file:///Volumes/Work/s/w/ir/x/w/sdk/pkg/vm/bin/kernel_service.dart:1024:37)
<asynchronous suspension>Metadata
Metadata
Assignees
Labels
area-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.