Skip to content

Evaluation results in different variable #60121

@FMorschel

Description

@FMorschel

Env: Dart 3.8.0-edge.a14aa2612c0e738aaa5ba2f6b84986710f947eee - Windows 11 x64

Steps:

  • Clone https://github.com/FMorschel/sdk/tree/auto-complete-instance branch
  • Place a breakpoint in pkg\analysis_server\lib\src\handler\legacy\completion_get_suggestions2.dart at line 241
  • Run the new test at pkg\analysis_server\test\services\completion\dart\location\dart_doc_test.dart (failing but not the point)

See the type of completionRequest:

Image

See the hover result:

Image

Not a subclass of List:

Image

Here is the watch:

At this point we can see that it thinks completionRequest is actually suggestions, but another weird thing I found was when I tried evaluating the line 241 (completionRequest.replacementOffset) to see why it was failing, on debug console. I'm unsure of the LegacyAnalysisServer.handleRequest but maybe evaluation still uses legacy. This is the stacktrace but I guess this unrelated to the actual problem:

Unhandled exception:
NoSuchMethodError: Class 'List<CompletionSuggestion>' has no instance getter 'replacementOffset'.
Receiver: Instance(length:1) of '_GrowableList'
Tried calling: replacementOffset
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5)
#1      CompletionGetSuggestions2Handler.Eval ()
#2      CompletionGetSuggestions2Handler.handle.<anonymous closure>.<anonymous closure> (package:analysis_server/src/handler/legacy/completion_get_suggestions2.dart:241:31)
#3      OperationPerformanceImpl.run (package:analyzer/src/util/performance/operation_performance.dart:155:23)
#4      CompletionGetSuggestions2Handler.handle.<anonymous closure> (package:analysis_server/src/handler/legacy/completion_get_suggestions2.dart:238:19)
< asynchronous suspension>
#5      OperationPerformanceImpl.runAsync (package:analyzer/src/util/performance/operation_performance.dart:174:14)
< asynchronous suspension>
#6      CompletionGetSuggestions2Handler.handle (package:analysis_server/src/handler/legacy/completion_get_suggestions2.dart:141:5)
< asynchronous suspension>
#7      LegacyAnalysisServer.handleRequest.<anonymous closure>.<anonymous closure> (package:analysis_server/src/legacy_analysis_server.dart:643:13)
< asynchronous suspension>
#8      OperationPerformanceImpl.runAsync (package:analyzer/src/util/performance/operation_performance.dart:174:14)
< asynchronous suspension>
#9      LegacyAnalysisServer.handleRequest.<anonymous closure> (package:analysis_server/src/legacy_analysis_server.dart:623:9)
< asynchronous suspension>

CC @DanTup.

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onarea-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.triagedIssue has been triaged by sub team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions