Summary
After use foo::Bar, a bare Bar reference does not resolve — validation reports Unknown type 'Bar'. Only the qualified form foo::Bar works. In Rust, use foo::Bar; binds Bar in scope; Comline should match that.
Repro
// src/types.ids
struct User {
id: u64
}
// src/api.ids
use types::User
struct Session {
user: User // ERR: Unknown type 'User' - did you mean 'str'?
}
Works if written user: types::User.
Confirmed across every form — only the qualified reference resolves:
after use types::User (or {User} / * / crate::types::User) |
user: User |
user: types::User |
| resolves? |
❌ |
✅ |
Where
core/src/schema/ir/compiler/interpreter/incremental.rs — resolve_use_declaration emits FrozenUnit::Import("types::User", span) (fully-qualified). The validator (core/src/schema/ir/validation/) then only matches a field type against that qualified string, not against the trailing symbol.
Fix is one of:
resolve_use_declaration also records the local binding (bare User -> types::User), and validation consults it; or
- validation accepts a bare type name that equals the last segment of some in-scope
Import (with a collision check).
use foo::Bar as Baz should bind Baz the same way.
Context
Surfaced while adding PackageSources (#42). Not a regression - pre-existing. Doesn't block the playground work (qualified references work).
Summary
After
use foo::Bar, a bareBarreference does not resolve — validation reportsUnknown type 'Bar'. Only the qualified formfoo::Barworks. In Rust,use foo::Bar;bindsBarin scope; Comline should match that.Repro
Works if written
user: types::User.Confirmed across every form — only the qualified reference resolves:
use types::User(or{User}/*/crate::types::User)user: Useruser: types::UserWhere
core/src/schema/ir/compiler/interpreter/incremental.rs—resolve_use_declarationemitsFrozenUnit::Import("types::User", span)(fully-qualified). The validator (core/src/schema/ir/validation/) then only matches a field type against that qualified string, not against the trailing symbol.Fix is one of:
resolve_use_declarationalso records the local binding (bareUser->types::User), and validation consults it; orImport(with a collision check).use foo::Bar as Bazshould bindBazthe same way.Context
Surfaced while adding
PackageSources(#42). Not a regression - pre-existing. Doesn't block the playground work (qualified references work).