Skip to content

long and float literals show no editable value in the inspector and are captioned Literal<Int64>; the coverage test misses them #137

Description

@matt-edmondson

What's wrong

The serializer, deserializer and every generator fully support LiteralExpression<long> and LiteralExpression<float> (the round trip was fixed in #83). The graph layer only knows the other four literal types:

  • Inspector: AstFields.Of (Coder.Graph/AstFields.cs:336-339) and TryWrite (:544-547) handle string, int, double and bool only. A long or float literal falls through to _ => [], so the inspector shows nothing and the value cannot be edited.
  • Caption: AstSchema.Describe (Coder.Graph/AstSchema.cs:707-710) also falls back to GetNodeTypeName(), so the node is captioned Literal<Int64> or Literal<Single> instead of showing its value.
  • Test: AstNodeCoverageTests (Coder.Test/Graph/AstNodeCoverageTests.cs:52) closes generic node types over StorageTypes = [string, int, double, bool] only. The test exists to catch exactly this gap ("a node type left out of either draws an empty inspector rather than failing anything"), but it cannot see these two types.

Failure scenario

Open a document containing:

returnStatement:
  expression:
    literal<Int64>:
      value: 5000000000

Select the literal node. The inspector is empty and the node reads Literal<Int64> instead of 5000000000. The only way to change the value is to edit the YAML by hand. literal<Single> behaves the same way.

Suggested fix / acceptance criteria

  • Add LiteralExpression<long> (as Number, with a new AssignLong parser) and LiteralExpression<float> (as Fraction, formatted so it round-trips) to AstFields.Of, AstFields.TryWrite and AstSchema.Describe.
  • Add typeof(long) and typeof(float) to StorageTypes in AstNodeCoverageTests so the reflective test enforces this from now on.
  • Optionally, add Long and Float entries under Literals in AstNodeCatalog.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions