mirror of
https://github.com/leanprover/lean4.git
synced 2026-03-17 18:34:06 +00:00
doc: namespace A.B vs namespace A namespace B
This commit is contained in:
committed by
Leonardo de Moura
parent
7cddeaa0d3
commit
3b6755dea1
26
tests/elabissues/nested_namespace_vs_prefix.lean
Normal file
26
tests/elabissues/nested_namespace_vs_prefix.lean
Normal file
@@ -0,0 +1,26 @@
|
||||
/-
|
||||
@rwbarton found the following surprising:
|
||||
-/
|
||||
|
||||
-- 1. When you are in `A.B`, you are not in `A`.
|
||||
|
||||
def A.foo : String := "A.foo"
|
||||
|
||||
namespace A.B
|
||||
|
||||
def bar : String := foo -- error: unknown identifier 'foo'
|
||||
|
||||
end A.B
|
||||
|
||||
namespace A
|
||||
namespace B
|
||||
|
||||
def bar : String := foo -- succeeds
|
||||
|
||||
end B
|
||||
end A
|
||||
|
||||
/-
|
||||
I (@dselsam) agree it is a little weird, and suggest
|
||||
either we disallow the first case or we make it sugar for the second.
|
||||
-/
|
||||
Reference in New Issue
Block a user