Skip to content

Reserved keywords in module paths give 'expected identifier' — no hint about the keyword #6

Closed

Description

@ehartford

Current behavior

use crux.view
error: expected identifier
 --> test/smoke.w:2:4
2 | use crux.view
  |    ^

The caret points at crux, not view. There is zero indication that view is a reserved keyword causing the failure. An agent will try renaming crux, restructuring the path, changing the import style — everything except renaming the module.

Expected behavior

error: 'view' is a reserved keyword and cannot be used as a module name
 --> test/smoke.w:2:10
2 | use crux.view
  |          ^^^^
  = help: rename the module to avoid the keyword, e.g. 'views'

Broader issue

There should be a way to discover which words are reserved. Either:

  • with help keywords lists all reserved words
  • The error message names the specific keyword that collided

Without this, users have to discover reserved words by trial and error.

Repro

mkdir -p /tmp/wbug/lib/crux
echo "pub fn make_view -> i32: 42" > /tmp/wbug/lib/crux/view.w
printf "use crux.view\nfn main: let x = make_view()\n" > /tmp/wbug/main.w
cd /tmp/wbug && with check main.w

Activity

  1. added
    error-messages
    on Mar 20, 2026
  2. ehartford commented on Mar 20, 2026

    @ehartford
    ContributorAuthor

    Verified on current main: the original use crux.view repro no longer errors. A temporary module at lib/crux/view.w imports and checks cleanly now, so this issue no longer reflects current behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    error-messages

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions