Skip to content

feat(sv)!: support interface class handles and $cast of class handles - #1758

Merged
mergify[bot] merged 1 commit into
masterfrom
stack/tignear/feat/string-class-heap/support-interface-class-handles-cast-class-handles--1edcc030
Oct 23, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
stack/tignear/feat/string-class-heap/support-interface-class-handles-cast-class-handles--1edcc030

Conversation

@tignear

@tignear tignear commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

A variable of an interface class type holds a handle of an object whose
class implements it; a method called through it runs the implementation
of the object's class, including methods the interface class inherits
from the interface classes it extends (IEEE 1800-2023 8.26). Each method
of an interface class gets a dispatcher like a virtual method's.

A handle may only be assigned to a variable of its class, a base class or
an interface class it implements; any other assignment to a variable, a
property or from C::new is rejected (8.16, 8.26.5).

$cast to a class handle calls a subroutine generated for the
destination class: it assigns a source that is null or whose object's
class derives from or implements the class and returns 1, and otherwise
returns 0, leaving the destination unchanged. Called as a task, a failing
cast reports an error. A cast between classes that are not cast
compatible fails without a call (8.16).

Interface classes are now lowered; one whose methods use its own typedefs
or type parameters is left without subroutines and rejected only where
its handles are used.

sv-tests: 8.26.5--cast_between_interface_classes now passes in both state
modes (543 / 545). Verilator's failing interface-to-interface casts and
inherited interface methods, and Icarus's missing $cast and interface
classes, are recorded as limitations.

BREAKING CHANGE: AnalyzerError has an IncompatibleClassHandle variant,
and assignments of incompatible class handles that were accepted are now
rejected.

Depends-On: #1724

@tignear

tignear commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor Author

This pull request is part of a Mergify stack:

# Pull Request Link
1 feat(sv): support static class members, super and base constructors #1696
2 feat(sv): support virtual methods, abstract classes and interface class implementation #1724
3 feat(sv)!: support interface class handles and $cast of class handles #1758 👈

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-22T14:48:34.357990Z
We couldn’t complete this review. Comment @codex review to try again.
7fa07c6 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@mergify

mergify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Queued — the merge queue status continues in this comment ↓.

A variable of an interface class type holds a handle of an object whose
class implements it; a method called through it runs the implementation
of the object's class, including methods the interface class inherits
from the interface classes it extends (IEEE 1800-2023 8.26). Each method
of an interface class gets a dispatcher like a virtual method's.

A handle may only be assigned to a variable of its class, a base class or
an interface class it implements; any other assignment to a variable, a
property or from `C::new` is rejected (8.16, 8.26.5).

`$cast` to a class handle calls a subroutine generated for the
destination class: it assigns a source that is `null` or whose object's
class derives from or implements the class and returns 1, and otherwise
returns 0, leaving the destination unchanged. Called as a task, a failing
cast reports an error. A cast between classes that are not cast
compatible fails without a call (8.16).

Interface classes are now lowered; one whose methods use its own typedefs
or type parameters is left without subroutines and rejected only where
its handles are used.

sv-tests: 8.26.5--cast_between_interface_classes now passes in both state
modes (543 / 545). Verilator's failing interface-to-interface casts and
inherited interface methods, and Icarus's missing $cast and interface
classes, are recorded as limitations.

BREAKING CHANGE: `AnalyzerError` has an `IncompatibleClassHandle` variant,
and assignments of incompatible class handles that were accepted are now
rejected.

Change-Id: I1edcc030c35a6bec183c76b567cff49e1319a7e5
@tignear
tignear force-pushed the stack/tignear/feat/string-class-heap/support-virtual-methods-abstract-classes--1f9a009a branch from 4f8b9c2 to a95ad5e Compare October 22, 2026 21:12
@tignear
tignear force-pushed the stack/tignear/feat/string-class-heap/support-interface-class-handles-cast-class-handles--1edcc030 branch from 7fa07c6 to 462d189 Compare October 22, 2026 21:12
@tignear

tignear commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Revision history

# Type Changes Reason Date
1 initial 7fa07c6 2026-10-22 21:10 UTC
2 content 7fa07c6 → 462d189 Rebased onto master after #1737; the $cast helper initializes the new persistent_locals field and the sv-tests totals rise by one for its two accepted rows. 2026-10-22 21:10 UTC

Base automatically changed from stack/tignear/feat/string-class-heap/support-virtual-methods-abstract-classes--1f9a009a to master October 22, 2026 23:36
@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 22, 2026
@mergify mergify Bot added the queued Mergify queue entry label Oct 22, 2026
@mergify

mergify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-22 23:43 UTC · Rule: changes · triggered by rule Queue explicitly requested merges
  • ✅ Checks passed · on draft merge queue: checking #1758 on master (d7bb5a3) #1780
  • ✅ Merged — 2026-10-23 01:00 UTC · at 573429958d650cff4c769d7476f0889bad7a639c · merge

This pull request spent 1 hour 16 minutes 41 seconds in the queue, including 1 hour 10 minutes 45 seconds running CI.

Required conditions to merge
  • check-success = Conventional Commit title
  • check-success = Queue validation
  • depends-on = celox-sim/celox#1724 [⛓️ feat(sv): support virtual methods, abstract classes and interface class implementation #1724]
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Lint & Format
    • check-neutral = @github-actions/Lint & Format
    • check-skipped = @github-actions/Lint & Format
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-neutral = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-skipped = @github-actions/NAPI Build (Linux ARM64 GNU)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/NAPI Build (Windows)
    • check-neutral = @github-actions/NAPI Build (Windows)
    • check-skipped = @github-actions/NAPI Build (Windows)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Rust Test & NAPI Build
    • check-neutral = @github-actions/Rust Test & NAPI Build
    • check-skipped = @github-actions/Rust Test & NAPI Build
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/JS Test (Ubuntu)
    • check-neutral = @github-actions/JS Test (Ubuntu)
    • check-skipped = @github-actions/JS Test (Ubuntu)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/JS Test (Windows)
    • check-neutral = @github-actions/JS Test (Windows)
    • check-skipped = @github-actions/JS Test (Windows)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Conventional Commit title
    • check-neutral = @github-actions/Conventional Commit title
    • check-skipped = @github-actions/Conventional Commit title

@mergify
mergify Bot merged commit 5734299 into master Oct 23, 2026
37 of 58 checks passed
@mergify
mergify Bot deleted the stack/tignear/feat/string-class-heap/support-interface-class-handles-cast-class-handles--1edcc030 branch October 23, 2026 01:00
@mergify mergify Bot removed the queued Mergify queue entry label Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-ready Request merging through Mergify after required checks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant