Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execution Continues Despite Type Conversion Error #3764

Open
notJoon opened this issue Feb 17, 2025 · 0 comments
Open

Execution Continues Despite Type Conversion Error #3764

notJoon opened this issue Feb 17, 2025 · 0 comments
Labels
🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related

Comments

@notJoon
Copy link
Member

notJoon commented Feb 17, 2025

Description

The compiler (or, IDE) displays a type conversion error but continues compilation and execution.

go: https://go.dev/play/p/-1gby11D6fv
gno: https://play.gno.land/p/J-sLKDi24K-

Minimal Reproduction Code

type Reader interface {
   Read() string
}

type StringReader interface {
   Reader
   ReadString() string
}

func main() {
   var t interface{}
   var sr StringReader
   t = sr
   var r = Reader(t)  // <- in here, IDE shows the error
   println(r)
}

// Output:
// (undefined)

Current Behaviour

  1. Compiler displays the correct error message
  2. But continues compilation despite the error
  3. Produces an executable that runs and prints "undefined"

Expected Behaviour

cannot convert t (variable of type interface{}) to type Reader: interface{} does not implement Reader (missing method Read)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related
Projects
Status: Triage
Development

No branches or pull requests

2 participants