Coder Social home page Coder Social logo

Comments (4)

scheglov avatar scheglov commented on July 18, 2024

Interesting, I don't see a hard hang in unit tests for the element model and resolution.
But when I do it in IntelliJ, DAS sends server error.

## Dart analysis issue

Bad state: Unrecognized code part Instance of 'NamedTypeAnnotationImpl'

## Version information

- Dart SDK 3.5.0-edge.9315ae565160afea5ae049bde6aacd0cc077b07d
- Dart IntelliJ 241.15845
- IntelliJ IDEA 2024.1
- Mac OS X 14.4.1

## Details

Bad state: Unrecognized code part Instance of 'NamedTypeAnnotationImpl'

#0 SerializeCode.serialize (package:_macros/src/executor/serialization_extensions.dart:609:13)
#1 MacroExecutionResultImpl.serialize (package:_macros/src/executor/response_impls.dart:479:22)
#2 SerializeNullable.serializeNullable (package:_macros/src/executor/serialization_extensions.dart:495:12)
#3 SerializableResponse.serialize (package:_macros/src/executor/protocol.dart:136:18)
#4 MacroExpansionClient._handleMessage. (package:_macros/src/executor/client.dart:136:16)

#5 MacroExpansionClient._handleMessage (package:_macros/src/executor/client.dart:118:5)


## Debug log

1712867529318 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}}
1712867529344 <= {"event":"analysis.errors","params":{"file":"/Users/scheglov/dart/test/bin/test3.dart","errors":[{"severity":"ERROR","type":"COMPILE_TIME_ERROR","location":{"file":"/Users/scheglov/da...
1712867529345 <= {"event":"analysis.highlights","params":{"file":"/Users/scheglov/dart/test/bin/test3.dart","regions":[{"type":"DIRECTIVE","offset":0,"length":11},{"type":"BUILT_IN","offset":0,"length...
1712867529345 <= {"event":"analysis.navigation","params":{"file":"/Users/scheglov/dart/test/bin/test3.dart","regions":[{"offset":30,"length":1,"targets":[0]},{"offset":41,"length":3,"targets":[1]}],"t...
1712867529345 <= {"event":"analysis.outline","params":{"file":"/Users/scheglov/dart/test/bin/test3.dart","kind":"LIBRARY","outline":{"element":{"kind":"COMPILATION_UNIT","name":"","location":{"f...
1712867529345 <= {"event":"analysis.overrides","params":{"file":"/Users/scheglov/dart/test/bin/test3.dart","overrides":[]}}
1712867529378 <= {"id":"19590","result":{"replacementOffset":8,"replacementLength":1,"suggestions":[{"kind":"IMPORT","relevance":900,"completion":"append.dart","selectionOffset":11,"selectionLength":0...
1712867529382 <= {"event":"analysis.errors","params":{"file":"/Users/scheglov/dart/test/bin/test.dart","errors":[{"severity":"ERROR","type":"COMPILE_TIME_ERROR","location":{"file":"/Users/scheglov/dar...
1712867529413 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}}
1712867529414 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}}
1712867529414 <= {"event":"analysis.implemented","params":{"file":"/Users/scheglov/dart/test/bin/test3.dart","classes":[],"members":[]}}
1712867529443 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}}
1712867530127 => {"id":"19591","method":"analysis.updateContent","params":{"files":{"/Users/scheglov/dart/test/bin/test3.dart":{"type":"add","content":"import 'appen';\n\n@CrashMe()\nclass A {\n void...
1712867530130 <= {"id":"19591","result":{}}
1712867530130 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}}
1712867530169 <= {"event":"analysis.errors","params":{"file":"/Users/scheglov/dart/test/bin/test3.dart","errors":[{"severity":"ERROR","type":"COMPILE_TIME_ERROR","location":{"file":"/Users/scheglov/da...
1712867530169 <= {"event":"analysis.highlights","params":{"file":"/Users/scheglov/dart/test/bin/test3.dart","regions":[{"type":"DIRECTIVE","offset":0,"length":15},{"type":"BUILT_IN","offset":0,"length...
1712867530169 <= {"event":"analysis.navigation","params":{"file":"/Users/scheglov/dart/test/bin/test3.dart","regions":[{"offset":34,"length":1,"targets":[0]},{"offset":45,"length":3,"targets":[1]}],"t...
1712867530169 <= {"event":"analysis.outline","params":{"file":"/Users/scheglov/dart/test/bin/test3.dart","kind":"LIBRARY","outline":{"element":{"kind":"COMPILATION_UNIT","name":"","location":{"f...
1712867530169 <= {"event":"analysis.overrides","params":{"file":"/Users/scheglov/dart/test/bin/test3.dart","overrides":[]}}
1712867530173 <= {"event":"analysis.errors","params":{"file":"/Users/scheglov/dart/test/bin/test.dart","errors":[{"severity":"ERROR","type":"COMPILE_TIME_ERROR","location":{"file":"/Users/scheglov/dar...
1712867530206 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}}
1712867530206 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}}
1712867530206 <= {"event":"analysis.implemented","params":{"file":"/Users/scheglov/dart/test/bin/test3.dart","classes":[],"members":[]}}
1712867530231 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}}
1712867530474 => {"id":"19592","method":"analysis.updateContent","params":{"files":{"/Users/scheglov/dart/test/bin/test3.dart":{"type":"add","content":"import 'append.dart';\n\n@CrashMe()\nclass A {\n...
1712867530479 => {"id":"19593","method":"edit.getFixes","params":{"file":"/Users/scheglov/dart/test/bin/test3.dart","offset":2},"clientRequestTime":1712867530479}
1712867530479 <= {"id":"19592","result":{}}
1712867530479 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}}
1712867530485 => {"id":"19594","method":"edit.getAssists","params":{"file":"/Users/scheglov/dart/test/bin/test3.dart","offset":19,"length":0},"clientRequestTime":1712867530485}

from sdk.

scheglov avatar scheglov commented on July 18, 2024

Ah, I run unit tests with asserts enabled, so the mistake does not allow you to create such invalid Code.fromParts() at all. But if you don't have asserts enabled, e.g. when you run DAS from IntelliJ, you can. But then it hard crash later, at the point where it is not an assert. Which means that the first point also should be not just an assert, but full check. Or better typing.

from sdk.

scheglov avatar scheglov commented on July 18, 2024

The reason it hangs is that the analyzer does not get a response from the macro running isolate.
The macro isolate created the result, and crashed trying to send it, below in serialize().

        case MessageType.executeDeclarationsPhaseRequest:
          ExecuteDeclarationsPhaseRequest request =
              ExecuteDeclarationsPhaseRequest.deserialize(deserializer, zoneId);
          (await _executeDeclarationsPhase(request, sendRequest))
              .serialize(serializer);

If we checked inside Code.fromParts(), we would send the exception result instead.

from sdk.

scheglov avatar scheglov commented on July 18, 2024

https://dart-review.googlesource.com/c/sdk/+/362440

from sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.