Skip to content

bug: using std causes misleading error for undefined types like i512 #914

@SchoolyB

Description

@SchoolyB

Summary

When any using directive is present, undefined types that look like sized integers (e.g., i512) produce a misleading "type mismatch" error instead of "undefined type".

Steps to Reproduce

Without using (correct behavior):

do main() {
    temp x i512 = 123
}
error[E3008]: undefined type 'i512'
  --> file.ez:2:10
   |
2  |     temp x i512 = 123
   |          ^ type is not defined

With any using directive (incorrect behavior):

import @std
using std

do main() {
    temp x i512 = 123
}
error[E3001]: type mismatch: cannot assign int to i512
  --> file.ez:5:10
   |
5  |     temp x i512 = 123
   |          ^ types do not match

Additional Testing

  • Happens with using std, using crypto, using math - any using directive
  • Does NOT happen with just import @module (no using)
  • Other invalid types like foobar, i7, i100, i1024 correctly show "undefined type" even with using
  • Issue appears specific to i512 pattern

Expected Behavior

Both cases should show error[E3008]: undefined type 'i512'.

Root Cause

The using directive appears to affect type resolution in a way that causes i512 to be treated as a valid type instead of undefined. This may be related to #909 (using directive scope issues).

Environment

  • EZ version: dev (tested on main branch)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingerror-messagesRelated to improving error messagesgood first issueGood for newcomerstypecheckerRelated to type checking and validation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions