-
Notifications
You must be signed in to change notification settings - Fork 808
Using open or export does not make names accessible for extended field notation (dot notation) #3031
Copy link
Copy link
Closed
Labels
P-mediumWe may work on this issue if we find the timeWe may work on this issue if we find the timeRFCRequest for commentsRequest for comments
Description
Description
If you try to use open or export to import names to use for dot notation, it does not work. Confusingly, you can have String.a "x" succeed but "x".a fail.
Context
Zulip thread where this was brought up, during an Advent of Code problem.
Steps to Reproduce
Observe that "x".a produces an error in the following
namespace Common
namespace String
def a (s : String) : Nat := s.length
end String
end Common
open Common (String.a)
#eval String.a "x"
/-
invalid field 'a', the environment does not contain 'String.a'
"x"
has type
String
-/
#eval "x".a
export Common (String.a)
/-
invalid field notation, function 'Common.String.a' does not have argument
with type (Common.String ...) that can be used, it must be explicit or
implicit with a unique name
-/
#eval "x".aExpected behavior: The second and third #evals have the same interpretation as the first.
Actual behavior: Only the first succeeds. The second #eval (when the name is just open) doesn't see String.a at all, and the third #eval (when the name is exported) it sees it but then fails to process it correctly.
Versions
MacOS arm64
/- "4.3.0-rc2" -/
#eval Lean.versionStringImpact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P-mediumWe may work on this issue if we find the timeWe may work on this issue if we find the timeRFCRequest for commentsRequest for comments