Skip to content

REALM-004: Replace realm nesting if-chain with 6x6 lookup table #19

@Raulgooo

Description

@Raulgooo

Summary

is_realm_nesting_legal in src/typecheck.c uses an if-chain. Replace with a static const bool 2D array indexed by [outer][inner] per spec §8.

Scope

  1. Read spec §8 nesting matrix and extract all 36 legal/illegal combinations
  2. Implement as static const bool realm_nesting_legal[6][6] (indexed by MemoryRealm enum values)
  3. Replace the if-chain with a single table lookup
  4. Any promotion rules with conditional logic (e.g., unsafe block overrides) must be flagged in a comment as requiring code outside the table

Acceptance Criteria

  • All existing realm tests still pass
  • Table matches spec §8 matrix exactly
  • If-chain removed

Related

  • Spec §8

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew featureintermediateSome compiler knowledge requiredphase-6Realm Checker phasetypecheckType checker component

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions