8000 Compiler rejects optional type (`Cell?`) with `as remaining`, contradicting documentation · Issue #3448 · tact-lang/tact · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Compiler rejects optional type (Cell?) with as remaining, contradicting documentation #3448
Open
@Gusarich

Description

@Gusarich

The compiler currently rejects the combination of an optional type (Cell?) with the as remaining serialization annotation, despite the documentation explicitly stating that optionals can use the same serialization annotations as their underlying types.

Minimal Reproducible Example:

struct TestRemainingOptional {
    prefix: Int as uint8;
    data: Cell? as remaining; // Compiler rejects this line
}

contract TestContract {
    s: TestRemainingOptional;
    init(){
        self.s = TestRemainingOptional{prefix:0, data:null};
    }
    receive() {}
}

Compiler Output:

Error: The "as remaining" field cannot have optional type

Expected Behavior (per documentation):
This combination (Cell? as remaining) should compile successfully. The optional type prefix (1-bit indicator) should determine if the remaining slice is parsed into a Cell or remains empty.

Documentation Reference:

"Optionals can have serialization annotations provided after the as keyword and have all the same serialization options as their encapsulated primitive or struct types."

This indicates a clear inconsistency between documented capabilities and actual compiler behavior.


LLM Fuzzing discovery (see #2490)

Metadata

Metadata

Assignees

No one assigned

    Labels

    activity: llm-fuzzingIssues found using LLM fuzzingkind: docsDocumentation for docs.tact-lang.org kept in docs folder

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0