In-source return refinement `_ == true --> s(this)` binds `this` to the return value (Argument Mismatch)

Đang mở
#442 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
backend, testing-qa

Hướng nghiên cứu

Start with the in-source verifier path for @Refinement return clauses and compare how it binds this with the external-spec path. Run the one-file reproducer from the issue and confirm the boolean versus Edit argument mismatch; use the stated external refinement example as a comparison. Done when the in-source example verifies and the external example continues to verify.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

A boolean method that reveals a state when it returns true, @Refinement("_ == true --> b(this)"), fails when the class is annotated in its own source. The same form verifies in an @ExternalRefinementsFor spec.

Reproducer (one file; run the verifier on it):

import liquidjava.specification.Refinement;
import liquidjava.specification.StateRefinement;
import liquidjava.specification.StateSet;

@StateSet({"a", "b"})
class Edit {
    @StateRefinement(to = "a(this)")
    public Edit() {}

    @StateRefinement(to = "b(this)")
    public void finish() {}

    @Refinement("_ == true --> b(this)")
    public boolean isDone() { return true; }

    @StateRefinement(from = "b(this)")
    public void needsB() {}
}

public class Main {
    static void use(Edit e) {
        if (e.isDone()) e.needsB();   // a true answer says b
    }
    public static void main(String[] args) { Edit e = new Edit(); e.finish(); use(e); }
}

Found on main @ f7f366c (also on 1a506fe):

Argument Mismatch Error: Argument '#ret_6' and its respective parameter of ghost 'Edit.state1' types are incompatible: expected Edit, got boolean
19 |     public boolean isDone() { return true; }

this in the return refinement seems to be bound to the return value (#ret_6) instead of the receiver.

Expected: the program verifies, as it does when the same refinements are written in an external spec. For example, this one verifies:

@ExternalRefinementsFor("javax.swing.undo.AbstractUndoableEdit")
@StateSet({"done", "undone"})
public interface EditRefinements {
    @StateRefinement(to = "done(this)") void AbstractUndoableEdit();
    @Refinement("_ == true --> done(this)") boolean canUndo();
    @StateRefinement(from = "done(this)", to = "undone(this)") void undo();
}
// client: static void use(AbstractUndoableEdit e) { if (e.canUndo()) e.undo(); }

Found while cataloguing spec forms for co-specification; the reproducers are probes V11 (in-source) and V21 (external) there. Low priority: external specs, the main use, work.

Ngôn ngữ chính
Java
Star
73
Fork
38
Merge trung bình
12 giờ 32 phút
Pull request đã merge (30 ngày)
45

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của liquid-java/liquidjava

Tất cả issue của liquid-java/liquidjava

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.