The kind/shape solving pass can currently report misleading follow-on unknown type errors for local types that are not actually unknown, but only failed earlier in the same package.
Example from test_workspace/Bosatsu/Eval.bosatsu on the current branch:
11. type error
in type Leaf unknown type Bosatsu/Lazy::Lazy in constructor LazyLeaf
12. type error
in type Eval unknown type Leaf in constructor Pure
13. type error
in type Stack unknown type Eval in constructor Last
That last message is misleading. Eval is not unknown; it was already seen and failed to compile because it depended on Leaf, which had already failed.
This looks like a regression in the newer alias-aware KindFormula.solveShapesAndKinds path. The older solveAll logic tracked a failed set and skipped solving later types whose dependsOn referenced previously failed local types, which avoided these misleading UnknownConst cascades.
A small repro should look like:
package Repro
export Bad, UsesBad
enum Bad:
Bad(x: Missing)
enum UsesBad:
UsesBad(x: Bad)
Expected behavior:
- Report the original failure on
Bad.
- Do not later report
Bad as an unknown type inside UsesBad.
- Either suppress the dependent error entirely, or replace it with a diagnostic that says
UsesBad depends on Bad, which had previous errors.
This is separate from export diagnostics. The root issue here is that kind/shape inference is treating previously-failed local items as if they were absent from the local environment, which creates noisy and misleading follow-on errors.
The kind/shape solving pass can currently report misleading follow-on
unknown typeerrors for local types that are not actually unknown, but only failed earlier in the same package.Example from
test_workspace/Bosatsu/Eval.bosatsuon the current branch:That last message is misleading.
Evalis not unknown; it was already seen and failed to compile because it depended onLeaf, which had already failed.This looks like a regression in the newer alias-aware
KindFormula.solveShapesAndKindspath. The oldersolveAlllogic tracked afailedset and skipped solving later types whosedependsOnreferenced previously failed local types, which avoided these misleadingUnknownConstcascades.A small repro should look like:
Expected behavior:
Bad.Badas an unknown type insideUsesBad.UsesBaddepends onBad, which had previous errors.This is separate from export diagnostics. The root issue here is that kind/shape inference is treating previously-failed local items as if they were absent from the local environment, which creates noisy and misleading follow-on errors.