Skip to content

Type Mismatch Error Reports expected value Instead of expected struct #223

@aspizu

Description

@aspizu

incorrect error message when a struct literal is assigned to a mismatched type — reports expected value instead of expected struct_name.

Steps to Reproduce

  1. Declare a variable of type xy.
  2. Assign it a struct literal of type xyz.
xy a = xyz{x:0, y:0, z:0};

Actual Behavior

The compiler produces the following error:

error: type mismatch: expected value, but got xyz
 --> playground/main.gs:7:12
  |
7 |     xy a = xyz{x:0,y:0,z:0};
  |            ^^^
  |

Expected Behavior

The error message should name the expected type explicitly:

error: type mismatch: expected xy, but got xyz
 --> playground/main.gs:7:12
  |
7 |     xy a = xyz{x:0,y:0,z:0};
  |            ^^^
  |

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions