winglang / winglang/wing

Confusing error message if you try to access an internal enum

Open
#6,985 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🐛 bug 🛠️ compiler
Dominant language
TypeScript
Stars
5.4k
Forks
215
Avg merge
2h 9m
Merged PRs (30d)
27

Description

Confusing error message if you try to access an internal enum

"error: Expected identifier "fixture" to be a variable, but it's a namespace
  --> ../../../examples/tests/invalid/internal_access_modifiers.test.w:3:9
  |
3 | let e = fixture.FavoritePlanets.MARS;
  |         ^^^^^^^

Originally posted by @Chriscbr in https://github.com/winglang/wing/pull/6980#discussion_r1702275372

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running examples/tests/invalid/internal_access_modifiers.test.w and inspect the diagnostic produced at line 3 for the internal enum access. Trace the compiler entry point that reports this error and clarify the message so it accurately describes the attempted access instead of reporting only a namespace-versus-variable mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.