Skip to content

sema: avoid panic on external call in state-variable initializer (Solana)#1894

Open
SAY-5 wants to merge 1 commit intohyperledger-solang:mainfrom
SAY-5:say5/sema-state-init-external-1869
Open

sema: avoid panic on external call in state-variable initializer (Solana)#1894
SAY-5 wants to merge 1 commit intohyperledger-solang:mainfrom
SAY-5:say5/sema-state-init-external-1869

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 2, 2026

Fixes #1869.

The Solana "accounts are required" check in function_call.rs unconditionally unwrapped context.function_no. State-variable initializers are resolved at file scope where function_no is None, so any external call there panicked. Match on the option and treat the no-function case as not external / not constructor so the diagnostic still fires.

…(Solana)

Signed-off-by: SAY-5 <say.apm35@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compiler panic in sema: Option::unwrap() on None for context.function_no when an external call appears in a state-variable initializer

1 participant