0
当编译如下代码:编译与模块细化
module Interface {
function addSome(n: nat): nat
ensures addSome(n) > n
}
module Mod {
import A : Interface
method m() {
assert 6 <= A.addSome(5);
print "Test\n";
}
}
module Implementation refines Interface {
function addSome(n: nat): nat
ensures addSome(n) == n + 1
{
n + 1
}
}
module Mod2 refines Mod {
import A = Implementation
}
method Main() {
Mod2.m();
}
我得到的输出
Dafny program verifier finished with 5 verified, 0 errors
Compilation error: Function _0_Interface_Compile._default.addSome has no body
鉴于Implementation
提炼Interface
,为什么编译器还需要Interface.addSome
有一个组织,特别是当addSome
反正是鬼,所以不应该参与编译?