meta.language.types.tuples

Parentheses always denote a tuple, including () and a single element with or without a trailing comma. (T) is distinct from T when result types are compared for an override.

Read in specification context · design/meta/language.md

Implementation

Implemented crates/sage-meta/src/parser.rs:201–206

sage_meta::parser · lib:sage_meta

#![allow(unused)]
fn main() {
        // {anchor}`meta.language.types.tuples`
        let kind = if self.eat("(") {
            let items = self.type_list(")")?;
            TypeExprKind::Tuple(items)
        } else {
            let path = self.parse_path(true)?;

}

See more source ↗

Implemented crates/sage-meta/src/validate.rs:624–629

sage_meta::validate · lib:sage_meta

#![allow(unused)]
fn main() {
    // {anchor}`meta.language.types.tuples`
    fn resolve_type(
        &self,
        namespace: &str,
        parameters: &[String],
        ty: &TypeExpr,

}

See more source ↗

Tests and review

Indexed tests and the implementation-completeness and test-adequacy review; no test run is implied.

Implemented sage_meta::parentheses_always_denote_tuples

crates/sage-meta/tests/value_types.rs · test:value_types

#![allow(unused)]
fn main() {
#[test]
#[sage::test(meta.language.types.tuples)]
fn parentheses_always_denote_tuples() {
    let document =
        parse_body("struct Tuples { zero: (), one: (bool), comma: (bool,), two: (bool, u32) }")
            .unwrap();
    let Declaration::Type(tuples) = &document.declarations[0] else {
        panic!("expected a value declaration")
    };
    let TypeShape::Struct(fields) = &tuples.shape else {
        panic!("expected a struct")
    };
    for (field, arity) in fields.iter().zip([0, 1, 1, 2]) {
        assert!(matches!(&field.ty.kind, TypeExprKind::Tuple(elements) if elements.len() == arity));
    }
    let errors = check(
        r#"class Base { """Base.""" fn value() -> bool { """Get.""" envelope {} } }
        class Child extends crate::Base { """Child."""
            override fn value() -> (bool) { """Get.""" envelope {} }
        }"#,
    );
    assert_eq!(errors.len(), 1, "{errors:?}");
    assert!(
        errors[0]
            .message
            .contains("preserve method kind and result type")
    );
}
}

See more source ↗

Review: Accepted · Codex /root/anchor_219.

Reviewed the complete claim, both ordinary implementation entries (parser and validate), and the sole ordinary test parentheses_always_denote_tuples; no TODO/N/A entries or prerequisites exist. Parser::type_expr unconditionally constructs Tuple on an opening parenthesis, and type_list accepts empty, singleton with or without comma, and multiple elements. The test parses (), (bool), (bool,), and (bool, u32), and asserts Tuple variants with arities 0, 1, 1, 2. The captured parse_body/check helpers invoke the actual parser and validator. resolve_type recursively preserves tuple parentheses in canonical spelling while named types have distinct canonical names; override comparison uses those resolved results. The same test changes a base bool result to (bool) in its override and asserts exactly one result-signature diagnostic, directly detecting accidental singleton grouping. These assertions and source paths account for every claim aspect. Baseline verification independently found parser.rs, validate.rs, and value_types.rs exactly match historical source snapshots; the earlier rationale remains supported by current captured evidence, not merely its approval. Execution: ran review start and review read and performed exact baseline comparisons; no behavioral tests or workspace build were run by this reviewer. The coordinator separately reports 321 functional sage-meta tests and root cargo build passing. No source edits or further dependencies are needed.

Browse meta anchors

116 anchors

Specification anchors and declared coverage
AnchorImplementationTests
meta (116)102 Implemented24 TODO103 Implemented36 TODO
meta.anchors (22)22 Implemented21 Implemented12 TODO
anchor_pagesImplementedImplementedTODO
book_explorerImplementedImplementedTODO
canonical_sourcesImplementedImplementedTODO
meta.anchors.content (7)7 Implemented7 Implemented
blocksImplementedImplemented
explicit_endImplementedImplemented
headingImplementedImplemented
literal_syntaxImplementedImplemented
next_anchorImplementedImplemented
source_endImplementedImplemented
unmatched_endImplementedImplemented
context_navigationImplementedImplementedTODO
evidence_statusImplementedImplementedTODO
explorer_navigationImplementedTODO
implementation_coverageImplementedImplementedTODO
implementation_referencesImplementedImplementedTODO
placeholder_statusImplementedImplementedTODO
point_excerptsImplementedImplementedTODO
region_balanceImplementedImplemented
region_excerptsImplementedImplementedTODO
test_coverageImplementedImplemented
test_referencesImplementedImplemented
unique_namesImplementedImplementedTODO
meta.book (21)10 Implemented18 TODO12 Implemented18 TODO
anchor_movesImplementedTODOImplementedTODO
authorityImplementedTODOImplementedTODO
browser_deliveryTODOImplementedTODO
browser_dependenciesTODOTODO
browser_rust_sourceTODOTODO
browser_searchTODOTODO
browser_serveTODOTODO
browser_structureTODOTODO
chapter_namesImplementedTODOImplementedTODO
crate_ownershipImplementedImplemented
crates_landingImplementedImplemented
entity_linksTODOTODO
index_groupsImplementedTODOImplementedTODO
index_namespace_pagesImplementedImplemented
index_rowsImplementedTODOImplementedTODO
index_statusImplementedTODOImplementedTODO
rfd_changesTODOTODO
sage_chaptersTODOImplementedTODO
self_descriptionTODOTODO
shared_modelImplementedTODOImplementedTODO
source_rolesTODOTODO
meta.contracts (4)4 Implemented3 TODO4 Implemented3 TODO
cache_invocationsImplementedTODOImplementedTODO
correspondenceImplementedImplemented
observation_coverageImplementedTODOImplementedTODO
validated_sessionImplementedTODOImplementedTODO
meta.language (39)39 Implemented39 Implemented
meta.language.calls (2)2 Implemented2 Implemented
declaredImplementedImplemented
forbiddenImplementedImplemented
meta.language.classes (3)3 Implemented3 Implemented
abstract_completeImplementedImplemented
override_signatureImplementedImplemented
single_inheritanceImplementedImplemented
meta.language.contexts (1)1 Implemented1 Implemented
inheritanceImplementedImplemented
meta.language.envelopes (7)7 Implemented7 Implemented
class_callsImplementedImplemented
createsImplementedImplemented
direct_callsImplementedImplemented
leafImplementedImplemented
permissionsImplementedImplemented
readsImplementedImplemented
receiver_callsImplementedImplemented
meta.language.fields (2)2 Implemented2 Implemented
context_stateImplementedImplemented
kindsImplementedImplemented
meta.language.methods (2)2 Implemented2 Implemented
kindsImplementedImplemented
proseImplementedImplemented
meta.language.model (3)3 Implemented3 Implemented
forbidden_pathsImplementedImplemented
inherited_prohibitionsImplementedImplemented
virtual_dispatchImplementedImplemented
meta.language.types (19)19 Implemented19 Implemented
argument_arityImplementedImplemented
declaration_proseImplementedImplemented
enum_variantsImplementedImplemented
field_proseImplementedImplemented
generic_parametersImplementedImplemented
member_commasImplementedImplemented
name_resolutionImplementedImplemented
opaque_representationImplementedImplemented
preludeImplementedImplemented
qualified_namesImplementedImplemented
recursive_valuesImplementedImplemented
struct_fieldsImplementedImplemented
tuplesImplementedImplemented
type_expressionsImplementedImplemented
unique_fieldsImplementedImplemented
unique_parametersImplementedImplemented
unique_variantsImplementedImplemented
unknown_namesImplementedImplemented
variant_proseImplementedImplemented
meta.reviews (27)27 Implemented27 Implemented
claim_textImplementedImplemented
complete_test_setImplementedImplemented
decisionsImplementedImplemented
fragment_associationsImplementedImplemented
fragment_formatImplementedImplemented
fragment_freshnessImplementedImplemented
gateImplementedImplemented
input_formatImplementedImplemented
input_fragmentsImplementedImplemented
output_formatImplementedImplemented
preparationImplementedImplemented
record_requiredImplementedImplemented
recorded_readsImplementedImplemented
recordingImplementedImplemented
review_delegationImplementedImplemented
review_diagnosticsImplementedImplemented
review_instructionsImplementedImplemented
review_scopeImplementedImplemented
selector_claimImplementedImplemented
selector_line_rangeImplementedImplemented
selector_testImplementedImplemented
selector_whole_fileImplementedImplemented
source_representationImplementedImplemented
stalenessImplementedImplemented
summary_formatImplementedImplemented
test_sourceImplementedImplemented
validation_layoutImplementedImplemented
meta.validation (3)3 TODO3 TODO
claim_specific_evidenceTODOTODO
independent_inspectionTODOTODO
review_packetsTODOTODO