feat: support module-qualified constructor patterns in match expressions (issue 3)

Added module: Option<Ident> to Pattern::Constructor, updated parser to
handle module.Constructor(args) syntax in patterns, exported ADT
constructors from modules, and copied type definitions during module
import so types like Shape are usable in importing files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-20 09:46:51 -05:00
parent caabaeeb9c
commit 1fc472a54c
6 changed files with 70 additions and 11 deletions

View File

@@ -697,8 +697,9 @@ pub enum Pattern {
Var(Ident),
/// Literal: 42, "hello", true
Literal(Literal),
/// Constructor: Some(x), None, Ok(v)
/// Constructor: Some(x), None, Ok(v), module.Constructor(x)
Constructor {
module: Option<Ident>,
name: Ident,
fields: Vec<Pattern>,
span: Span,