Skip to content

Invalid argument(s): Unexpectedly not indexed: T #60745

Open
@Fabricio-191

Description

@Fabricio-191

Code:

class CustomType<T> {
  static CustomType<T> staticProperty;
}

final MY_TYPE = CustomType.staticProperty;

Expected behavior: "Static members can't reference type parameters of the class.
Try removing the reference to the type parameter, or making the member an instance member." on static CustomType<T> staticProperty; line

Actual behavior: Dart analyzer crashes with log:

[9:54:33 PM] [Analyzer] [Error] [Invalid argument(s): Unexpectedly not indexed: T
#0      _LocalElementIndexer.[] (package:analyzer/src/summary2/bundle_writer.dart:1316:10)
#1      ResolutionSink._indexOfElement (package:analyzer/src/summary2/bundle_writer.dart:900:27)
#2      ResolutionSink._writeElement (package:analyzer/src/summary2/bundle_writer.dart:935:24)
#3      ResolutionSink.writeElement (package:analyzer/src/summary2/bundle_writer.dart:815:7)
#4      ResolutionSink.writeType (package:analyzer/src/summary2/bundle_writer.dart:875:7)
#5      ResolutionSink.writeType (package:analyzer/src/summary2/bundle_writer.dart:858:11)
#6      BundleWriter._writeTopLevelVariableElement (package:analyzer/src/summary2/bundle_writer.dart:671:21)
#7      BundleWriter._writeList (package:analyzer/src/summary2/bundle_writer.dart:48…

dart --version: Dart SDK version: 3.7.2 (stable) (Tue Mar 11 04:27:50 2025 -0700) on "windows_x64"

I tried deleting everything inside my analysis_options.yaml but it didn't change anything

Note: if you delete the line final MY_TYPE = CustomType.staticProperty; it works as expected, so probably when dart analyzer tries to determine the type of the MY_TYPE variable something weird happens

Note 2: this issue seems somewhat similar to #48096

Log: log-562c.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.model-crashesCrashes in the analyzer or CFE

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions