Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
c966100
Format files
purefunctor Feb 17, 2026
f418652
Add core type structures
purefunctor Feb 17, 2026
37eca57
Add checking2 crate with ExternalQueries, CheckedModule, and check_prim
purefunctor Feb 17, 2026
7a2ce63
Add context module with CheckContext and caches for known types
purefunctor Feb 17, 2026
d97dfce
Implement CheckState and scaffolding for check_foreign_signature
purefunctor Feb 17, 2026
fa41a49
Implement safety utilities for use in checking rules
purefunctor Feb 17, 2026
8759771
Implement UnificationState for unification variable bookkeeping
purefunctor Feb 17, 2026
a0fc545
Implement core::normalise for unification variable pruning
purefunctor Feb 17, 2026
96944c9
Implement ErrorCrumb, ErrorKind, CheckError
purefunctor Feb 18, 2026
65ada2f
Implement initial utilities for constructing types
purefunctor Feb 18, 2026
e6bfa4a
Add depth field to Type::Rigid
purefunctor Feb 18, 2026
9e8a75c
Add fold and walk abstractions for core
purefunctor Feb 18, 2026
112d944
Implement core::substitute and SubstituteName
purefunctor Feb 18, 2026
e2e8b4f
Add depth tracking and with_depth to CheckState
purefunctor Feb 18, 2026
f85899d
Add fresh_unification and fresh_rigid helpers to CheckState
purefunctor Feb 18, 2026
4fe0bcd
Implement core::unification and initial rules
purefunctor Feb 17, 2026
1c54bbd
Implement unification variable solving and promotion
purefunctor Feb 18, 2026
2fdb0d2
Add text field to ForallBinder
purefunctor Feb 18, 2026
23b6f8a
Implement pretty-printer for core
purefunctor Feb 18, 2026
e1d87ab
Use pretty printer in error messages
purefunctor Feb 18, 2026
5b1ccf8
Implement collection for implication constraints
purefunctor Feb 18, 2026
e4502cb
Implement subtyping and unification for rows
purefunctor Feb 18, 2026
9bede66
Add utility for pretty-print-intern
purefunctor Feb 19, 2026
bbf92e4
Implement syntax-driven kind checking rules
purefunctor Feb 18, 2026
5d71fc2
Implement detection for type synonym applications
purefunctor Feb 19, 2026
28a9269
Move check_kind/infer_kind internals to _core functions
purefunctor Feb 19, 2026
6f5b2a5
Allow Constraint kinds in Constraint and Forall
purefunctor Feb 19, 2026
468bf9c
Add documentation to ElaborationMode
purefunctor Feb 19, 2026
fcea5e6
Refactor subtyping to use a strategy pattern
purefunctor Feb 19, 2026
74611fb
Update documentation for SubstituteName
purefunctor Feb 19, 2026
1cdea7b
Add documentation for function subtyping
purefunctor Feb 19, 2026
bcd3566
Add documentation for forall subtyping
purefunctor Feb 19, 2026
ecacc2e
Add documentation for record subtyping
purefunctor Feb 19, 2026
066c445
Add documentation for unification rules
purefunctor Feb 19, 2026
b630b33
Add stub for check_data_signature
purefunctor Feb 19, 2026
53d98cc
Implement ReplaceThen for folding
purefunctor Feb 20, 2026
3c19d30
Implement generalisation
purefunctor Feb 19, 2026
2343c13
Implement zonking traversal
purefunctor Feb 20, 2026
e7558a8
Implement stateless pretty printer
purefunctor Feb 20, 2026
165ebea
Align synonym application with type application
purefunctor Feb 20, 2026
937d496
Add as_slice and is_recursive for Scc
purefunctor Feb 20, 2026
856a404
Implement binding group seeding for SCCs
purefunctor Feb 20, 2026
f479eee
Implement core::toolkit and function_components
purefunctor Feb 20, 2026
dc6a916
Implement initial check_data_equation
purefunctor Feb 20, 2026
e55c874
Partition invalid items and populate with unknowns
purefunctor Feb 21, 2026
3c4e61a
Move Zonk::on to zonk
purefunctor Feb 21, 2026
ec0c141
Add documentation for check_type_items
purefunctor Feb 21, 2026
c85f3a5
Improve type signature and variable checking
purefunctor Feb 21, 2026
523cc10
Rename to check_data_constructors
purefunctor Feb 22, 2026
b65f3bd
Make generalise solve unification variables to rigid variables
purefunctor Feb 23, 2026
b5cbcdf
Accept IntoIter for intern_function_chain
purefunctor Feb 23, 2026
d0aed3d
Collect ForallBinder in check_type_variable_bindings
purefunctor Feb 23, 2026
635dc10
Return ForallBinder in data check and infer modes
purefunctor Feb 23, 2026
27a39bb
Add toolkit functions for inspection
purefunctor Feb 23, 2026
108ff9c
Add terms field for CheckState
purefunctor Feb 23, 2026
6f84881
Implement generalisation for constructors
purefunctor Feb 23, 2026
e94d195
Format files and apply clippy
purefunctor Feb 23, 2026
7df9a5d
Add CoreInterners struct for checking2
purefunctor Feb 23, 2026
76d4650
Add initial support for checking2 in QueryEngine
purefunctor Feb 23, 2026
1e00b73
Add support for checking2 in integration tests
purefunctor Feb 23, 2026
5130012
Add initial integration tests for foreign data
purefunctor Feb 23, 2026
1965674
Use flags for compiler-scripts snapshot manipulation
purefunctor Feb 23, 2026
a2a4c86
Move .claude to .agents and add symlinks to skills
purefunctor Feb 23, 2026
84263ee
Add initial tests for data declarations
purefunctor Feb 23, 2026
4d6be0d
Add initial tests for newtype declarations
purefunctor Feb 23, 2026
3d965b1
Add checking rule for synonym signatures
purefunctor Feb 23, 2026
e9326fd
Use unique for generating variable names
purefunctor Feb 24, 2026
80cdc23
Implement builder-style API for printer
purefunctor Feb 24, 2026
95b526b
Implement checking and inference for synonyms
purefunctor Feb 23, 2026
8c1f828
Apply clippy fixes
purefunctor Feb 24, 2026
d6f0eae
Add CheckedClass type and extend CheckedModule with classes map
purefunctor Feb 24, 2026
863e5bb
Implement ClassGroup checking in source.rs
purefunctor Feb 24, 2026
db758b2
Add Classes section to checking2 test reports
purefunctor Feb 24, 2026
e3a0ed2
Add integration tests for class checking
purefunctor Feb 24, 2026
297e691
Implement operator declaration checking
purefunctor Feb 24, 2026
5d35ce3
Add integration tests for operator declarations
purefunctor Feb 24, 2026
4aeba3b
Move lookup functions to toolkit
purefunctor Feb 24, 2026
11321e9
Name::as_text for missing text
purefunctor Feb 24, 2026
47a817e
Implement operator chain checking for types
purefunctor Feb 24, 2026
1c8a60f
Implement integration tests for operator chains
purefunctor Feb 24, 2026
2c9c7e6
Implement initial elaborate_kind
purefunctor Feb 24, 2026
dd8fa1a
Improve formatting code for integration tests
purefunctor Feb 24, 2026
27fab9a
Use SmolStrId for ForallBinder::text
purefunctor Feb 24, 2026
6efbb19
Implement basic role inference
purefunctor Feb 24, 2026
44a79e1
Add integration tests for role inference
purefunctor Feb 24, 2026
226b9fd
Implement initial term signature checking
purefunctor Feb 25, 2026
32ad36f
Add integration tests for foreign and value terms
purefunctor Feb 25, 2026
34cafe1
Implement checking for term operators
purefunctor Feb 25, 2026
ee99551
Add integration tests for term operators
purefunctor Feb 25, 2026
3968786
Move item rules to separate modules
purefunctor Feb 25, 2026
25ecbbe
Implement CheckedNodes structure and accessors
purefunctor Feb 25, 2026
7bf9033
Move instantiate_unifications to toolkit
purefunctor Feb 25, 2026
e80ed36
Move decompose_function_kind to toolkit
purefunctor Feb 25, 2026
cc26ea4
Implement checking rules for binders
purefunctor Feb 25, 2026
881496d
Initial scaffolding for term checking
purefunctor Feb 25, 2026
720d292
Port over initial rules for term checking
purefunctor Feb 25, 2026
7b3744e
Format files and apply clippy fixes
purefunctor Feb 25, 2026
13e28a8
Port exhaustiveness checking to checking2
purefunctor Feb 25, 2026
56d1e80
Add integration tests for exhaustiveness checking
purefunctor Feb 25, 2026
f405ae9
Split intern_function_chain and intern_function_chain_iter
purefunctor Feb 25, 2026
de15f1f
Implement defer for partial synonym applications
purefunctor Feb 25, 2026
9440938
Organise CheckState fields
purefunctor Feb 26, 2026
50f823a
Fix generalisation bug for Scc::Mutual
purefunctor Feb 26, 2026
f065a14
Introduce quantification for class canonical types
purefunctor Feb 26, 2026
8454b29
Implement initial instance declaration checking
purefunctor Feb 26, 2026
f705853
Add integration test for instance declaration checking
purefunctor Feb 26, 2026
ee76e85
Track canonical names in CheckedModule
purefunctor Feb 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ test' [x] = x
just t checking NNN MMM
```

### 4. Accept or reject snapshots

```bash
just t checking NNN --diff # Inspect a fixture diff
just t checking NNN --accept # Accept a specific fixture
just t checking NNN --reject # Reject a specific fixture
just t checking --accept --confirm # Accept all pending snapshots
```

## Multi-File Tests

For imports, re-exports, or cross-module behavior:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ just t <category> --delete "name" # Dry-run fixture deletion (use --confirm)
### Snapshot commands

```bash
just t <category> accept [--all] [filters...] # Accept pending snapshots
just t <category> reject [--all] [filters...] # Reject pending snapshots
just t <category> [filters...] --accept # Accept matching snapshots
just t <category> [filters...] --reject # Reject matching snapshots
just t <category> --accept --confirm # Accept all pending snapshots
```

Requires `--all` flag when no filters provided (safety guardrail).
For safety, unfiltered `--accept` requires `--confirm`.

### Exclusion filters

Expand Down
1 change: 1 addition & 0 deletions .claude/skills
23 changes: 23 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions compiler-compatibility/command/src/compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ use petgraph::graphmap::DiGraphMap;
use rayon::prelude::*;
use url::Url;

use crate::loader;
use crate::resolver;
use crate::types::ResolvedSet;
use crate::{loader, resolver};

/// Result of checking a single file.
pub struct FileResult {
Expand Down Expand Up @@ -415,10 +414,11 @@ fn find_package_dir(packages_dir: &Path, package_name: &str) -> Option<std::path
for entry in entries.filter_map(Result::ok) {
let name = entry.file_name();
let name_str = name.to_string_lossy();
if let Some(suffix) = name_str.strip_prefix(&prefix) {
if suffix.parse::<semver::Version>().is_ok() && entry.file_type().ok()?.is_dir() {
return entry.path().canonicalize().ok();
}
if let Some(suffix) = name_str.strip_prefix(&prefix)
&& suffix.parse::<semver::Version>().is_ok()
&& entry.file_type().ok()?.is_dir()
{
return entry.path().canonicalize().ok();
}
}
None
Expand Down
1 change: 1 addition & 0 deletions compiler-core/building-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub enum QueryKey {
Bracketed(FileId),
Sectioned(FileId),
Checked(FileId),
Checked2(FileId),
}

#[derive(Error, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
Expand Down
2 changes: 2 additions & 0 deletions compiler-core/building/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ edition = "2024"
[dependencies]
building-types = { version = "0.1.0", path = "../building-types" }
checking = { version = "0.1.0", path = "../checking" }
checking2 = { version = "0.1.0", path = "../checking2" }
files = { version = "0.1.0", path = "../files" }
indexing = { version = "0.1.0", path = "../indexing" }
interner = { version = "0.1.0", path = "../interner" }
Expand All @@ -19,6 +20,7 @@ resolving = { version = "0.1.0", path = "../resolving" }
rustc-hash = "2.1.1"
stabilizing = { version = "0.1.0", path = "../stabilizing" }
sugar = { version = "0.1.0", path = "../sugar" }
smol_str = "0.3.2"
tempfile = "3.24.0"
thread_local = "1.1.9"
url = "2.5.7"
Expand Down
78 changes: 78 additions & 0 deletions compiler-core/building/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use building_types::{
ModuleNameId, ModuleNameInterner, QueryError, QueryKey, QueryProxy, QueryResult,
};
use checking::{CheckedModule, TypeInterner};
use checking2::CheckedModule as CheckedModule2;
use files::FileId;
use graph::SnapshotGraph;
use indexing::IndexedModule;
Expand Down Expand Up @@ -99,12 +100,14 @@ struct DerivedStorage {
bracketed: FxHashMap<FileId, DerivedState<Arc<sugar::Bracketed>>>,
sectioned: FxHashMap<FileId, DerivedState<Arc<sugar::Sectioned>>>,
checked: FxHashMap<FileId, DerivedState<Arc<CheckedModule>>>,
checked2: FxHashMap<FileId, DerivedState<Arc<CheckedModule2>>>,
}

#[derive(Default)]
struct InternedStorage {
module: ModuleNameInterner,
types: TypeInterner,
checking2: checking2::CoreInterners,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
Expand Down Expand Up @@ -428,6 +431,7 @@ impl QueryEngine {
QueryKey::Bracketed(k) => derived_changed!(bracketed, k),
QueryKey::Sectioned(k) => derived_changed!(sectioned, k),
QueryKey::Checked(k) => derived_changed!(checked, k),
QueryKey::Checked2(k) => derived_changed!(checked2, k),
}
}

Expand Down Expand Up @@ -757,6 +761,18 @@ impl QueryEngine {
},
)
}

pub fn checked2(&self, id: FileId) -> QueryResult<Arc<CheckedModule2>> {
self.query(
QueryKey::Checked2(id),
|storage| storage.derived.checked2.get(&id),
|storage| storage.derived.checked2.entry(id),
|this| {
let checked = checking2::check_module(this, id)?;
Ok(Arc::new(checked))
},
)
}
}

impl QueryEngine {
Expand Down Expand Up @@ -841,6 +857,68 @@ impl checking::ExternalQueries for QueryEngine {
}
}

impl checking2::ExternalQueries for QueryEngine {
fn checked2(&self, id: FileId) -> QueryResult<Arc<checking2::CheckedModule>> {
QueryEngine::checked2(self, id)
}

fn intern_type(&self, t: checking2::core::Type) -> checking2::core::TypeId {
let mut storage = self.storage.write();
storage.interned.checking2.intern_type(t)
}

fn lookup_type(&self, id: checking2::core::TypeId) -> checking2::core::Type {
let storage = self.storage.read();
storage.interned.checking2.lookup_type(id)
}

fn intern_forall_binder(
&self,
binder: checking2::core::ForallBinder,
) -> checking2::core::ForallBinderId {
let mut storage = self.storage.write();
storage.interned.checking2.intern_forall_binder(binder)
}

fn lookup_forall_binder(
&self,
id: checking2::core::ForallBinderId,
) -> checking2::core::ForallBinder {
let storage = self.storage.read();
storage.interned.checking2.lookup_forall_binder(id)
}

fn intern_row_type(&self, row: checking2::core::RowType) -> checking2::core::RowTypeId {
let mut storage = self.storage.write();
storage.interned.checking2.intern_row_type(row)
}

fn lookup_row_type(&self, id: checking2::core::RowTypeId) -> checking2::core::RowType {
let storage = self.storage.read();
storage.interned.checking2.lookup_row_type(id)
}

fn intern_synonym(&self, synonym: checking2::core::Synonym) -> checking2::core::SynonymId {
let mut storage = self.storage.write();
storage.interned.checking2.intern_synonym(synonym)
}

fn lookup_synonym(&self, id: checking2::core::SynonymId) -> checking2::core::Synonym {
let storage = self.storage.read();
storage.interned.checking2.lookup_synonym(id)
}

fn intern_smol_str(&self, s: smol_str::SmolStr) -> checking2::core::SmolStrId {
let mut storage = self.storage.write();
storage.interned.checking2.intern_smol_str(s)
}

fn lookup_smol_str(&self, id: checking2::core::SmolStrId) -> smol_str::SmolStr {
let storage = self.storage.read();
storage.interned.checking2.lookup_smol_str(id)
}
}

impl resolving::ExternalQueries for QueryEngine {}

impl sugar::ExternalQueries for QueryEngine {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ use std::iter;
use building_types::QueryResult;
use rustc_hash::FxHashSet;

use crate::ExternalQueries;
use crate::algorithm::constraint::{self, MatchInstance};
use crate::algorithm::state::{CheckContext, CheckState};
use crate::algorithm::toolkit;
use crate::core::{RowField, RowType};
use crate::{Type, TypeId};
use crate::{ExternalQueries, Type, TypeId};

use super::extract_symbol;

Expand Down Expand Up @@ -127,7 +126,10 @@ where
.storage
.intern(Type::Row(RowType::from_unsorted(union_fields, right_row.tail)));

Ok(Some(MatchInstance::Match { constraints: vec![], equalities: vec![(union, result)] }))
Ok(Some(MatchInstance::Match {
constraints: vec![],
equalities: vec![(union, result)],
}))
}
(_, Some(right_row), Some(union_row)) => {
if right_row.tail.is_some() {
Expand Down
20 changes: 20 additions & 0 deletions compiler-core/checking2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "checking2"
version = "0.1.0"
edition = "2024"

[dependencies]
building-types = { version = "0.1.0", path = "../building-types" }
files = { version = "0.1.0", path = "../files" }
indexing = { version = "0.1.0", path = "../indexing" }
interner = { version = "0.1.0", path = "../interner" }
itertools = "0.14.0"
lowering = { version = "0.1.0", path = "../lowering" }
petgraph = "0.8.3"
pretty = "0.12"
parsing = { version = "0.1.0", path = "../parsing" }
resolving = { version = "0.1.0", path = "../resolving" }
rustc-hash = "2.1.1"
smol_str = "0.3.5"
stabilizing = { version = "0.1.0", path = "../stabilizing" }
sugar = { version = "0.1.0", path = "../sugar" }
Loading