Skip to content

fix: report unsupported generic ABI declarations - #7715

Open
Soundcreates wants to merge 1 commit into
FuelLabs:masterfrom
Soundcreates:fix/reject-generic-abi-declarations
Open

fix: report unsupported generic ABI declarations#7715
Soundcreates wants to merge 1 commit into
FuelLabs:masterfrom
Soundcreates:fix/reject-generic-abi-declarations

Conversation

@Soundcreates

@Soundcreates Soundcreates commented Aug 13, 2026

Copy link
Copy Markdown

Issue

Closes #7703. Generic parameters in ABI declarations were either accepted without a useful diagnostic or produced confusing downstream errors when the ABI was implemented.

Fix

  • Detect generic parameters while converting ABI function declarations.
  • Emit a dedicated Generic parameters are not supported in ABI declarations. diagnostic at the generic parameter span.
  • Add an end-to-end compile-fail fixture covering the unsupported syntax.

Validation

  • cargo test -p sway-core --lib (20 passed).

@fuel-cla-bot

fuel-cla-bot Bot commented Aug 13, 2026

Copy link
Copy Markdown

Thanks for the contribution! Before we can merge this, we need @Soundcreates to sign the Fuel Labs Contributor License Agreement.

@cursor

cursor Bot commented Aug 13, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Early diagnostic-only change in ABI declaration lowering; no runtime or contract-call behavior changes.

Overview
ABI method signatures with type parameters (e.g. fn fun<T>()) are now rejected during ABI parse-tree conversion instead of slipping through or failing later with unclear errors.

When fn_signature.generics is present on an ABI interface fn, the compiler emits Generic parameters are not supported in ABI declarations. at the generic parameter span via new CompileError::GenericParametersNotSupportedInAbi, wired into the error span mapping like other ABI restrictions.

An e2e should_fail fixture (generic_parameters_in_abi) asserts the diagnostic on fn fun<T>() -> bool;.

Reviewed by Cursor Bugbot for commit 3887566. Bugbot is set up for automated code reviews on this repo. Configure here.

@Soundcreates
Soundcreates force-pushed the fix/reject-generic-abi-declarations branch from cef5300 to 3887566 Compare August 13, 2026 07:36
@Soundcreates
Soundcreates marked this pull request as ready for review August 13, 2026 16:06
@Soundcreates
Soundcreates requested a review from a team as a code owner August 13, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide clear error message that generics are not allowed in ABI declarations

1 participant