This PR fixes (1) an issue where private names are not unresolved when they are pretty printed, (2) an issue where in `pp.universes` mode names were allowed to shadow local names, (3) an issue where in `match` patterns constants shadowing locals wouldn't use `_root_`, and (4) an issue where tactics might have an incorrect "try this" when `pp.fullNames` is set. Adds more delaboration tests for name unresolution. It also cleans up the `delabConst` delaborator so that it uses `unresolveNameGlobalAvoidingLocals`, rather than doing any local context analysis itself. The `inPattern` logic has been removed; it was a heuristic added back in #575, but it now leads to incorrect results (and in `match` patterns, local names shadow constants in name resolution).
68 lines
1,006 B
Text
68 lines
1,006 B
Text
set_option pp.fullNames true
|
|
|
|
-- Issue 1
|
|
def foo := 10
|
|
|
|
def f (x : Nat) := x + x
|
|
|
|
namespace Bla
|
|
|
|
private def foo := "hello"
|
|
|
|
#check foo == "world" -- `foo` resolves to private `Bla.foo`
|
|
|
|
private def foo : Float := 1.0 -- should produce error like in other programming languages
|
|
|
|
end Bla
|
|
|
|
#check foo == 0
|
|
|
|
#check Bla.foo
|
|
|
|
-- Issue 2
|
|
namespace Boo
|
|
|
|
def boo := 100
|
|
|
|
namespace Bla
|
|
|
|
private def boo := "hello"
|
|
|
|
#check boo == "world" -- resolving to `Boo.Bla.boo` as expected
|
|
#check boo ++ "world" -- should work
|
|
|
|
end Bla
|
|
|
|
#check Bla.boo == "world"
|
|
#check boo == 100
|
|
|
|
end Boo
|
|
|
|
#check Boo.Bla.boo == "world"
|
|
#check Boo.boo == 100
|
|
|
|
/-
|
|
Should the following work?
|
|
```
|
|
namespace N
|
|
private def b := 10
|
|
end N
|
|
open N
|
|
#check b
|
|
```
|
|
-/
|
|
|
|
-- Issue 3
|
|
private def Nat.mul10 (x : Nat) := x * 10
|
|
def x := 10
|
|
|
|
#check x.mul10 -- dot-notation should work with local private declarations
|
|
|
|
|
|
-- Issue 4
|
|
|
|
def y := 10
|
|
private def y := "hello" -- produce error
|
|
|
|
private def z := 10
|
|
def z := "hello" -- produce error
|