GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Crash: @Ghost on a nested class gives "Sort mismatch ... supplied sort is Outer$Bag" · Issue #467 · liquid-java/liquidjava

Crash: @Ghost on a nested class gives "Sort mismatch ... supplied sort is Outer$Bag" #467

New issue
Copy link
New issue
Copy link
Open
Open
Crash: @Ghost on a nested class gives "Sort mismatch ... supplied sort is Outer$Bag"#467
Copy link
Labels
bugSomething isn't workingSomething isn't working

Description

@CatarinaGamboa
CatarinaGamboa
opened on Nov 3, 2026
Issue body actions

Impact: any @Ghost declared on a nested class crashes verification of every refinement that uses it; the same class at top level verifies.

Minimal reproducer

import liquidjava.specification.Ghost;
import liquidjava.specification.Refinement;
import liquidjava.specification.StateRefinement;

public class Outer {
    @Ghost("int size")
    static class Bag {
        @StateRefinement(to = "size(this) == 0")
        public Bag() {}

        @StateRefinement(to = "size(this) == size(old(this)) + 1")
        public void add() {}

        @StateRefinement(from = "size(this) > 0")
        public void remove() {}
    }

    static void ok() {
        Bag b = new Bag();
        b.add();
        b.remove();
    }
}

Expected: Correct! Passed Verification., as for the same Bag as a top-level class.

Actual (main @ 0053074):

Error: Sort mismatch at argument #1 for function (declare-fun Outer$Bag.size (Outer.Bag) Int) supplied sort is Outer$Bag
 9 |         public Bag() {}
10 | 
11 |         @StateRefinement(to = "size(this) == size(old(this)) + 1")
   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12 |         public void add() {}
13 | 

Error: Sort mismatch at argument #1 for function (declare-fun Outer$Bag.size (Outer.Bag) Int) supplied sort is Outer$Bag
12 |         public void add() {}
13 | 
14 |         @StateRefinement(from = "size(this) > 0")
   |                                  ^^^^^^^^^^^^^^
15 |         public void remove() {}
16 |     }

Cause. The two sides name the class's Z3 sort differently. TranslatorContextToZ3.addGhostFunction builds the ghost's domain from CtTypeReference.toString() (Outer.Bag), while TranslatorContextToZ3.getExpr builds the sort of this from getQualifiedName() (Outer$Bag). For a top-level class both are the same string. Using one naming for both (e.g. getQualifiedName() in addGhostFunction and getSort) should fix it.

🤖 Generated with Claude Code

Activity

  1. CatarinaGamboa
    added
    bugSomething isn't workingSomething isn't working
    on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.