fix: use resolveGlobalConstNoOverload at implementedBy attribute handler

This commit is contained in:
Leonardo de Moura 2020-10-10 11:40:18 -07:00
parent 89eebc9534
commit f84fa47566
2 changed files with 10 additions and 0 deletions

View file

@ -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")

View file

@ -0,0 +1,9 @@
new_frontend
namespace Foo
def f (x : Nat) : Nat := x + 1
@[implementedBy f] constant g : Nat → Nat
end Foo