src/contracts: Fix contracts on virtual and generic type
authorFlorian Deljarry <deljarry.florian@gmail.com>
Mon, 30 Sep 2019 02:17:53 +0000 (22:17 -0400)
committerFlorian Deljarry <deljarry.florian@gmail.com>
Mon, 30 Sep 2019 02:17:53 +0000 (22:17 -0400)
Signed-off-by: Florian Deljarry <deljarry.florian@gmail.com>

src/contracts.nit

index 156bb53..8244170 100644 (file)
@@ -158,7 +158,7 @@ private class CallSiteVisitor
                        var visited_mpropdef = visited_method.mpropdef
                        assert contract_facet != null and visited_mpropdef != null
 
                        var visited_mpropdef = visited_method.mpropdef
                        assert contract_facet != null and visited_mpropdef != null
 
-                       var unsafe_mtype = callsite.recv.resolve_for(callsite.recv, callsite.anchor, visited_mpropdef.mclassdef.mmodule, false)
+                       var unsafe_mtype = callsite.recv.resolve_for(visited_mpropdef.mclassdef.bound_mtype, callsite.anchor, visited_mpropdef.mclassdef.mmodule, true)
 
                        # This check is needed because the contract can appear after the introduction.
                        if unsafe_mtype.has_mproperty(visited_method.mpropdef.mclassdef.mmodule, contract_facet) then
 
                        # This check is needed because the contract can appear after the introduction.
                        if unsafe_mtype.has_mproperty(visited_method.mpropdef.mclassdef.mmodule, contract_facet) then