@@ -1620,15 +1620,6 @@ contract_deploy_consensus_test!(
16201620 contract_code: "(ynot 1 2)" ,
16211621) ;
16221622
1623- // // StaticCheckError: [`StaticCheckErrorKind::UTraitReferenceUnknownnknownFunction`]
1624- // // Caused by:
1625- // // Outcome: block accepted.
1626- // contract_deploy_consensus_test!(
1627- // static_check_error_trait_reference_unknown,
1628- // contract_name: "trait-ref-unknown",
1629- // contract_code: "",
1630- // );
1631-
16321623// StaticCheckError: [`StaticCheckErrorKind::IncorrectArgumentCount`]
16331624// Caused by:
16341625// Outcome: block accepted.
@@ -1700,6 +1691,7 @@ contract_deploy_consensus_test!(
17001691// StaticCheckError: [`StaticCheckErrorKind::IncompatibleTrait`]
17011692// Caused by: pass a trait to a trait parameter which is not compatible.
17021693// Outcome: block accepted.
1694+ // Note: Added in Clarity 2. Clarity 1 will trigger a [`StaticCheckErrorKind::TypeError`].
17031695contract_deploy_consensus_test ! (
17041696 static_check_error_incompatible_trait,
17051697 contract_name: "incompatible-trait" ,
@@ -1736,6 +1728,28 @@ contract_deploy_consensus_test!(
17361728 contract_code: "(get-burn-block-info? none u1)" ,
17371729) ;
17381730
1731+ // StaticCheckError: [`StaticCheckErrorKind::NoSuchStacksBlockInfoProperty`]
1732+ // Caused by:
1733+ // Outcome: block accepted.
1734+ // Note: This error was added in Clarity 3. Clarity 1, and 2
1735+ // will trigger a [`StaticCheckErrorKind::UnknownFunction`].
1736+ contract_deploy_consensus_test ! (
1737+ static_check_error_no_such_stacks_block_info_property,
1738+ contract_name: "no-such-stacks-info" ,
1739+ contract_code: "(get-stacks-block-info? none u1)" ,
1740+ ) ;
1741+
1742+ // StaticCheckError: [`StaticCheckErrorKind::NoSuchTenureInfoProperty`]
1743+ // Caused by:
1744+ // Outcome: block accepted.
1745+ // Note: This error was added in Clarity 3. Clarity 1, and 2
1746+ // will trigger a [`StaticCheckErrorKind::UnknownFunction`].
1747+ contract_deploy_consensus_test ! (
1748+ static_check_error_no_such_tenure_info_property,
1749+ contract_name: "no-such-tenure-info" ,
1750+ contract_code: "(get-tenure-info? none u1)" ,
1751+ ) ;
1752+
17391753// StaticCheckError: [`StaticCheckErrorKind::TraitReferenceUnknown`]
17401754// Caused by:
17411755// Outcome: block accepted.
@@ -1824,6 +1838,122 @@ contract_deploy_consensus_test!(
18241838 ) ,
18251839) ;
18261840
1841+ // StaticCheckError: [`StaticCheckErrorKind::BadTupleConstruction`]
1842+ // Caused by:
1843+ // Outcome: block accepted.
1844+ contract_deploy_consensus_test ! (
1845+ static_check_error_bad_tuple_construction,
1846+ contract_name: "bad-tuple-constr" ,
1847+ contract_code: "(tuple (name 1) (name 2))" ,
1848+ ) ;
1849+
1850+ // StaticCheckError: [`StaticCheckErrorKind::ExpectedTuple`]
1851+ // Caused by:
1852+ // Outcome: block accepted.
1853+ contract_deploy_consensus_test ! (
1854+ static_check_error_expected_tuple,
1855+ contract_name: "expected-tuple" ,
1856+ contract_code: "(get field-0 (some 1))" ,
1857+ ) ;
1858+
1859+ // StaticCheckError: [`StaticCheckErrorKind::NoSuchTupleField`]
1860+ // Caused by:
1861+ // Outcome: block accepted.
1862+ contract_deploy_consensus_test ! (
1863+ static_check_error_no_such_tuple_field,
1864+ contract_name: "no-such-tuple-f" ,
1865+ contract_code: "(get value (tuple (name 1)))" ,
1866+ ) ;
1867+
1868+ // StaticCheckError: [`StaticCheckErrorKind::NoSuchMap`]
1869+ // Caused by:
1870+ // Outcome: block accepted.
1871+ contract_deploy_consensus_test ! (
1872+ static_check_error_no_such_map,
1873+ contract_name: "no-such-map" ,
1874+ contract_code: "(map-get? non-existent (tuple (name 1)))" ,
1875+ ) ;
1876+
1877+ // StaticCheckError: [`StaticCheckErrorKind::BadFunctionName`]
1878+ // Caused by: defining a function whose signature does not start with an atom name.
1879+ // Outcome: block accepted.
1880+ contract_deploy_consensus_test ! (
1881+ static_check_error_bad_function_name,
1882+ contract_name: "bad-func-name" ,
1883+ contract_code: "(define-private (u1) u0)" ,
1884+ ) ;
1885+
1886+ // StaticCheckError: [`StaticCheckErrorKind::DefineFunctionBadSignature`]
1887+ // Caused by: defining a function with an empty signature list.
1888+ // Outcome: block accepted.
1889+ contract_deploy_consensus_test ! (
1890+ static_check_error_define_function_bad_signature,
1891+ contract_name: "def-func-bad-sign" ,
1892+ contract_code: "(define-private () 1)" ,
1893+ ) ;
1894+
1895+ // StaticCheckError: [`StaticCheckErrorKind::BadTupleFieldName`]
1896+ // Caused by: using `(get ...)` with a tuple field argument that is not an atom.
1897+ // Outcome: block accepted.
1898+ contract_deploy_consensus_test ! (
1899+ static_check_error_bad_tuple_field_name,
1900+ contract_name: "bad-tuple-field-name" ,
1901+ contract_code: "(get u1 (tuple (foo u0)))" ,
1902+ ) ;
1903+
1904+ // StaticCheckError: [`StaticCheckErrorKind::BadMapName`]
1905+ // Caused by: passing a literal instead of a map identifier to `map-get?`.
1906+ // Outcome: block accepted.
1907+ contract_deploy_consensus_test ! (
1908+ static_check_error_bad_map_name,
1909+ contract_name: "bad-map-name" ,
1910+ contract_code: "(map-get? u1 (tuple (id u0)))" ,
1911+ ) ;
1912+
1913+ // StaticCheckError: [`StaticCheckErrorKind::GetBlockInfoExpectPropertyName`]
1914+ // Caused by: calling `get-block-info` with a non-atom property argument.
1915+ // Outcome: block accepted.
1916+ // Note: Only Clarity 1 and 2 will trigger this error. Clarity 3 and 4
1917+ // will trigger a [`StaticCheckErrorKind::UnknownFunction`].
1918+ contract_deploy_consensus_test ! (
1919+ static_check_error_get_block_info_expect_property_name,
1920+ contract_name: "info-exp-prop-name" ,
1921+ contract_code: "(get-block-info? u1 u0)" ,
1922+ ) ;
1923+
1924+ // StaticCheckError: [`StaticCheckErrorKind::GetBurnBlockInfoExpectPropertyName`]
1925+ // Caused by: calling `get-burn-block-info` with a non-atom property argument.
1926+ // Outcome: block accepted.
1927+ // Note: This error was added in Clarity 2. Clarity 1 will trigger
1928+ // a [`StaticCheckErrorKind::UnknownFunction`].
1929+ contract_deploy_consensus_test ! (
1930+ static_check_error_get_burn_block_info_expect_property_name,
1931+ contract_name: "burn-exp-prop-name" ,
1932+ contract_code: "(get-burn-block-info? u1 u0)" ,
1933+ ) ;
1934+
1935+ // StaticCheckError: [`StaticCheckErrorKind::GetStacksBlockInfoExpectPropertyName`]
1936+ // Caused by: calling `get-stacks-block-info` with a non-atom property argument.
1937+ // Outcome: block accepted.
1938+ // Note: This error was added in Clarity 3. Clarity 1 and 2 will trigger
1939+ // a [`StaticCheckErrorKind::UnknownFunction`].
1940+ contract_deploy_consensus_test ! (
1941+ static_check_error_get_stacks_block_info_expect_property_name,
1942+ contract_name: "stacks-exp-prop-name" ,
1943+ contract_code: "(get-stacks-block-info? u1 u0)" ,
1944+ ) ;
1945+
1946+ // StaticCheckError: [`StaticCheckErrorKind::GetTenureInfoExpectPropertyName`]
1947+ // Caused by: calling `get-tenure-info` with a non-atom property argument.
1948+ // Outcome: block accepted.
1949+ // Note: This error was added in Clarity 3. Clarity 1 and 2 will trigger
1950+ // a [`StaticCheckErrorKind::UnknownFunction`].
1951+ contract_deploy_consensus_test ! (
1952+ static_check_error_get_tenure_info_expect_property_name,
1953+ contract_name: "tenure-exp-prop-name" ,
1954+ contract_code: "(get-tenure-info? u1 u0)" ,
1955+ ) ;
1956+
18271957// pub enum StaticCheckErrorKind {
18281958// CostOverflow,
18291959// CostBalanceExceeded(ExecutionCost, ExecutionCost),
@@ -1853,22 +1983,22 @@ contract_deploy_consensus_test!(
18531983// UncheckedIntermediaryResponses, [`static_check_error_unchecked_intermediary_responses`]
18541984// CouldNotDetermineMatchTypes, [`static_check_error_could_not_determine_match_types`]
18551985// CouldNotDetermineType, [`static_check_error_could_not_determine_type`]
1856- // TypeAlreadyAnnotatedFailure,
1857- // CheckerImplementationFailure,
1986+ // TypeAlreadyAnnotatedFailure, // Unreachable: The AST assigner gives each node a unique `id`, and the type checker visits each node exactly once, so duplicate annotations cannot occur.
1987+ // CheckerImplementationFailure, // Unreachable
18581988// BadTokenName, [`static_check_error_bad_token_name`]
18591989// DefineNFTBadSignature, [`static_check_error_define_nft_bad_signature`]
18601990// NoSuchNFT(String), [`static_check_error_no_such_nft`]
18611991// NoSuchFT(String), [`static_check_error_no_such_ft`]
1862- // BadTupleFieldName,
1863- // ExpectedTuple(Box<TypeSignature>),
1864- // NoSuchTupleField(String, TupleTypeSignature),
1992+ // BadTupleFieldName, [`static_check_error_bad_tuple_field_name`]
1993+ // ExpectedTuple(Box<TypeSignature>), [`static_check_error_expected_tuple`]
1994+ // NoSuchTupleField(String, TupleTypeSignature), [`static_check_error_no_such_tuple_field`]
18651995// EmptyTuplesNotAllowed, [`static_check_error_empty_tuples_not_allowed`]
1866- // BadTupleConstruction(String),
1996+ // BadTupleConstruction(String), [`static_check_error_bad_tuple_construction`]
18671997// NoSuchDataVariable(String), [`static_check_error_no_such_data_variable`]
1868- // BadMapName,
1869- // NoSuchMap(String),
1870- // DefineFunctionBadSignature,
1871- // BadFunctionName,
1998+ // BadMapName, [`static_check_error_bad_map_name`]
1999+ // NoSuchMap(String), [`static_check_error_no_such_map`]
2000+ // DefineFunctionBadSignature, [`static_check_error_define_function_bad_signature`]
2001+ // BadFunctionName, [`static_check_error_bad_function_name`]
18722002// BadMapTypeDefinition, [`static_check_error_bad_map_type_definition`]
18732003// PublicFunctionMustReturnResponse(Box<TypeSignature>),
18742004// DefineVariableBadSignature, [`static_check_error_define_variable_bad_signature`]
@@ -1879,12 +2009,12 @@ contract_deploy_consensus_test!(
18792009// ContractCallExpectName, [`static_check_error_contract_call_expect_name`]
18802010// ExpectedCallableType(Box<TypeSignature>),
18812011// NoSuchBlockInfoProperty(String), [`static_check_error_no_such_block_info_property`]
1882- // NoSuchStacksBlockInfoProperty(String),
1883- // NoSuchTenureInfoProperty(String),
1884- // GetBlockInfoExpectPropertyName,
1885- // GetBurnBlockInfoExpectPropertyName,
1886- // GetStacksBlockInfoExpectPropertyName,
1887- // GetTenureInfoExpectPropertyName,
2012+ // NoSuchStacksBlockInfoProperty(String), [`static_check_error_no_such_stacks_block_info_property`]
2013+ // NoSuchTenureInfoProperty(String), [`static_check_error_no_such_tenure_info_property`]
2014+ // GetBlockInfoExpectPropertyName, [`static_check_error_get_block_info_expect_property_name`]
2015+ // GetBurnBlockInfoExpectPropertyName, [`static_check_error_get_burn_block_info_expect_property_name`]
2016+ // GetStacksBlockInfoExpectPropertyName, [`static_check_error_get_stacks_block_info_expect_property_name`]
2017+ // GetTenureInfoExpectPropertyName, [`static_check_error_get_tenure_info_expect_property_name`]
18882018// NameAlreadyUsed(String), [`static_check_error_name_already_used`]
18892019// ReservedWord(String), [`static_check_error_reserved_word`]
18902020// NonFunctionApplication, [`static_check_error_non_function_application`]
@@ -1893,7 +2023,7 @@ contract_deploy_consensus_test!(
18932023// MaxLengthOverflow, UNREACHABLE: should exceed u32 elements in memory.
18942024// BadLetSyntax, [`static_check_error_bad_let_syntax`]
18952025// BadSyntaxBinding(SyntaxBindingError), [`static_check_error_bad_syntax_binding`]
1896- // MaxContextDepthReached,
2026+ // MaxContextDepthReached, /// Unreachable: Before type checking runs, the parser enforces an AST nesting limit of (5 + 64). Any contract exceeding depth 69 fails with [`ParseErrorKind::ExpressionStackDepthTooDeep`].
18972027// UndefinedVariable(String), [`static_check_error_undefined_variable`]
18982028// RequiresAtLeastArguments(usize, usize), [`static_check_error_requires_at_least_arguments`]
18992029// RequiresAtMostArguments(usize, usize), [`static_check_error_requires_at_most_arguments`]
@@ -1903,10 +2033,10 @@ contract_deploy_consensus_test!(
19032033// DefaultTypesMustMatch(Box<TypeSignature>, Box<TypeSignature>), [`static_check_error_default_types_must_match`]
19042034// IllegalOrUnknownFunctionApplication(String), [`static_check_error_illegal_or_unknown_function_application`]
19052035// UnknownFunction(String), [`static_check_error_unknown_function`]
1906- // NoSuchTrait(String, String),
2036+ // NoSuchTrait(String, String), // Unreachable: all trait identifiers are validated by the parser and TraitsResolve before type checking; invalid or missing traits trigger TraitReferenceUnknown earlier, so this error is never returned.
19072037// TraitReferenceUnknown(String), [`static_check_error_trait_reference_unknown`]
19082038// TraitMethodUnknown(String, String), [`static_check_error_trait_method_unknown`]
1909- // ExpectedTraitIdentifier,
2039+ // ExpectedTraitIdentifier, // Unreachable: (use-trait …) or (impl-trait …) with an invalid second argument fails in the AST stage, raising ParseErrorKind::ImportTraitBadSignature/ImplTraitBadSignature before static checks run.
19102040// BadTraitImplementation(String, String),
19112041// DefineTraitBadSignature, [`static_check_error_define_trait_bad_signature`]
19122042// DefineTraitDuplicateMethod(String), [`static_check_error_define_trait_duplicate_method`]
0 commit comments