~duangle/scopes

prover.cpp: loop merge conflict error now points to loop header as source v1 PROPOSED

Westerbly Snaydley: 1
 prover.cpp: loop merge conflict error now points to loop header as source

 1 files changed, 1 insertions(+), 3 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~duangle/scopes/patches/11384/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] prover.cpp: loop merge conflict error now points to loop header as source Export this patch

# HG changeset patch
# User Westerbly Snaydley <westerbly@gmail.com>
# Date 1593438120 18000
#      Mon Jun 29 08:42:00 2020 -0500
# Node ID dc6cabdae1088c40fa22da6f9b2ff08be26ed7c0
# Parent  7fccfb5a02ee7da629d6860fceda7187922ac8c0
prover.cpp: loop merge conflict error now points to loop header as source

Previously the error message was anchored to the return type that precedes the conflicting one. This makes sense for functions where the return type is inferred by the return points, but not for loops where we always know the type (from the header).

diff --git a/src/prover.cpp b/src/prover.cpp
--- a/src/prover.cpp
+++ b/src/prover.cpp
@@ -1260,12 +1260,10 @@
    SCOPES_TRACE_PROVE_EXPR(loop);

    const Type *rtype = newloop->args->get_type();
    const Anchor *last_anchor = result.anchor();
    for (auto repeat : newloop->repeats) {
        SCOPES_CHECK_RESULT(merge_value_type("loop repeat", rtype,
            arguments_type_from_typed_values(repeat->values),
            last_anchor, repeat.anchor()));
        last_anchor = repeat.anchor();
            newloop.anchor(), repeat.anchor()));
    }

    return TypedValueRef(newloop);