Surface erasure errors in editor, fix issue checking erasure after inlining
This commit is contained in:
5
TODO.md
5
TODO.md
@@ -1,9 +1,12 @@
|
||||
|
||||
## TODO
|
||||
|
||||
- [ ] "Expected keyword" at `\ a ->` should be error at the `->`
|
||||
- [ ] Show Either
|
||||
- [ ] `local` for `where`-like `let` clauses? (I want a `where` that closes over more stuff)
|
||||
- [ ] Erasure checking happens at compile time and isn't surfaced to editor..
|
||||
- I can do `let f : ... = \ a b c => ...`. But it doesn't work for recursion and cases are awkward.
|
||||
- [x] Erasure checking happens at compile time and isn't surfaced to editor..
|
||||
- [ ] Erasure issue during AoC from case building replacing a non-erased value with erased.
|
||||
- [ ] Add Foldable?
|
||||
- [ ] "Failed to unify %var0 and %var1" - get names in there
|
||||
- Need fancier `Env`
|
||||
|
||||
@@ -181,12 +181,17 @@ processDef ns fc nm clauses = do
|
||||
-- moved to Compile.newt because it was interfering with type checking (Zoo4eg.newt) via over-reduction
|
||||
-- tm' <- zonk top 0 Nil tm
|
||||
|
||||
-- for effect, so we see errors in the editor
|
||||
-- We need to keep the _unerased_ term for checking
|
||||
_ <- erase Nil tm Nil
|
||||
|
||||
debug $ \ _ => "Add def \{nm} \{render 90 $ pprint Nil tm} : \{render 90 $ pprint Nil ty}"
|
||||
updateDef (QN ns nm) fc ty (Fn tm)
|
||||
-- putStrLn "complexity \{show (QN ns nm)} \{show $ complexity tm}"
|
||||
-- putStrLn $ show tm
|
||||
-- TODO we need some protection against inlining a function calling itself.
|
||||
-- We need better heuristics, maybe fuel and deciding while inlining.
|
||||
-- someday users will tag functions as inline, so maybe an explicit loop check
|
||||
-- IO,bind is explicit here because the complexity has a 100 in it.
|
||||
let name = show $ QN ns nm
|
||||
if complexity tm < 15 || name == "Prelude.Prelude.Monad Prelude.IO,bind" || name == "Prelude._>>=_"
|
||||
|
||||
10
tests/Quantity.newt.fail
Normal file
10
tests/Quantity.newt.fail
Normal file
@@ -0,0 +1,10 @@
|
||||
*** Process tests/Quantity.newt
|
||||
module Prelude
|
||||
module Quantity
|
||||
ERROR at tests/Quantity.newt:11:15--11:16: used erased value x$0 (FIXME FC may be wrong here)
|
||||
-- This should fail to compile
|
||||
bar : ∀ x. Nat
|
||||
bar {x} = foo x
|
||||
^
|
||||
|
||||
Compile failed
|
||||
Reference in New Issue
Block a user