kcl-lang / cli

The KCL Command Line Interface (CLI).
https://kcl-lang.io
Apache License 2.0
19 stars 13 forks source link

Bug: the diagnostic for `kcl vet` show an invalid file path #49

Closed zong-zhe closed 6 months ago

zong-zhe commented 7 months ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

The test.json

{
    "name": 10,
    "age": 18,
    "message": "This is Alice"
}

The main.k

schema User:
    name: str
    age: int
    message?: str

The command

kcl vet test.json main.k

2. What did you expect to see? (Required)

error[E2G22]: TypeError
 --> test.json:2:5
  |
2 |     "name": 10,
  |     ^ expected str, got int(10)
  |

 --> main.k:2:5
  |
2 |     name: str
  |     ^ variable is defined here, its type is str, but got int(10)
  |

3. What did you see instead (Required)

error[E2G22]: TypeError
 --> /var/folders/yt/9fs5v0ls7_q4kn7dq3k6nz3h0000gp/T/.tmpbX6kWB:2:5.  # The invalid file path
  |
2 |     "name": 10,
  |     ^ expected str, got int(10)
  |

 --> main.k:2:5
  |
2 |     name: str
  |     ^ variable is defined here, its type is str, but got int(10)
  |

4. What is your KCL components version? (Required)

The main branch

Peefy commented 6 months ago

Closed by https://github.com/kcl-lang/kcl/pull/1103