fix: use resolveGlobalConstNoOverload at implementedBy attribute handler
This commit is contained in:
parent
89eebc9534
commit
f84fa47566
2 changed files with 10 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ registerParametricAttribute `implementedBy "name of the Lean (probably unsafe) f
|
|||
decl ← getConstInfo declName;
|
||||
match attrParamSyntaxToIdentifier stx with
|
||||
| some fnName => do
|
||||
fnName ← resolveGlobalConstNoOverload fnName;
|
||||
fnDecl ← getConstInfo fnName;
|
||||
if decl.type == fnDecl.type then pure fnName
|
||||
else throwError ("invalid function '" ++ fnName ++ "' type mismatch")
|
||||
|
|
|
|||
9
tests/lean/run/impByNameResolution.lean
Normal file
9
tests/lean/run/impByNameResolution.lean
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
new_frontend
|
||||
|
||||
namespace Foo
|
||||
|
||||
def f (x : Nat) : Nat := x + 1
|
||||
|
||||
@[implementedBy f] constant g : Nat → Nat
|
||||
|
||||
end Foo
|
||||
Loading…
Add table
Reference in a new issue