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 — Reading a field of a class declared later in the file loses its refinement · Issue #316 · liquid-java/liquidjava

Reading a field of a class declared later in the file loses its refinement #316

New issue
Copy link
New issue
Copy link
Closed
#325
Closed
Reading a field of a class declared later in the file loses its refinement#316
#325
Copy link
Labels
bugSomething isn't workingSomething isn't working

Description

@CatarinaGamboa
CatarinaGamboa
opened on Oct 2, 2026
Issue body actions

Description

Reading a field of an object whose class is declared later in the file does not pick up the field's refinement, so a correct program fails with a false "not enough information" error. Writes to such fields are handled by #314 (fixing #308); reads are not.

Minimal reproducer

import liquidjava.specification.Refinement;

public class ReadBefore {
    private final Job job = new Job();

    @Refinement("_ >= 0")
    public int get() { return job.port; }

    static class Job { @Refinement("_ >= 0") int port; }
}

Expected

Correct! Passed Verification.

Actual

Refinement Error: true is not a subtype of #ret² >= 0
5 |     public int get() { return job.port; }
  |                        ^^^^^^^^^^^^^^^^
 --> Not enough information to prove the expected refinement. Add a refinement or condition to constrain it.

Moving Job above get makes it pass.

Cause

Fields enter the context only in the second pass (RefinementTypeChecker.visitCtField), in source order. When job.port is read, this#port is not in context yet, so visitCtFieldRead falls through to new Predicate() (no information).

Reproduced on main at fbfb4e2 (liquidjava-verifier 0.0.35), and on the #314 branch.

Activity

  1. CatarinaGamboa
    added
    bugSomething isn't workingSomething isn't working
    on Oct 2, 2026
  2. CatarinaGamboa
    added a parent issue on Oct 2, 2026
    • Handle refinements in nested classes #315
  3. CatarinaGamboa
    added a commit that references this issue on Oct 6, 2026

    Preserve refinement on forward declared field reads (#325)

    This issue will close once commit 69a0541 is merged into the 'main' branch.
    69a0541
  4. CatarinaGamboa
    closed this as completedin #325on Oct 6, 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.