PLC-lang/rusty

Improve `DataType` `SourceLocation`

Aberta

#1.343 aberto em 18 de out. de 2024

 (0 comentário) (0 reação) (0 responsável)Rust (71 forks)auto 404
buggood first issuemedium-priorityvalidation

Métricas do repositório

Stars
 (351 estrelas)
Métricas de merge de PR
 (Métricas PR pendentes)

Description

When parsing data-types, we include the initializer in the data-types source locations, leading to confusing error messages when converting the location to a slice:

FUNCTION main: DINT
VAR
    x: REF_TO STRING;
    y: REF_TO DINT := REF(x);
END_VAR
END_FUNCTION

error[E037]: Invalid assignment: cannot assign '__main_x' to 'REF_TO DINT := REF(x)'
  ┌─ target\demo.st:4:23
  │
4 │     y: REF_TO DINT := REF(x);
  │                       ^^^^^^ Invalid assignment: cannot assign '__main_x' to 'REF_TO DINT := REF(x)'

Guia do colaborador