Skip to content

Commit bc8ca17

Browse files
committed
remove unused CheckErrors' variants
1 parent 48770ee commit bc8ca17

File tree

2 files changed

+1
-18
lines changed

2 files changed

+1
-18
lines changed

clarity-types/src/errors/analysis.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -165,24 +165,20 @@ pub enum CheckErrors {
165165
BadMatchInput(TypeSignature),
166166

167167
// list typing errors
168-
UnknownListConstructionFailure,
169168
ListTypesMustMatch,
170169
ConstructedListTooLarge,
171170

172171
// simple type expectation mismatch
173172
TypeError(TypeSignature, TypeSignature),
174-
TypeLiteralError(TypeSignature, TypeSignature),
175173
TypeValueError(TypeSignature, Value),
176174

177-
NoSuperType(TypeSignature, TypeSignature),
178175
InvalidTypeDescription,
179176
UnknownTypeName(String),
180177

181178
// union type mismatch
182179
UnionTypeError(Vec<TypeSignature>, TypeSignature),
183180
UnionTypeValueError(Vec<TypeSignature>, Value),
184181

185-
ExpectedLiteral,
186182
ExpectedOptionalType(TypeSignature),
187183
ExpectedResponseType(TypeSignature),
188184
ExpectedOptionalOrResponseType(TypeSignature),
@@ -200,12 +196,10 @@ pub enum CheckErrors {
200196

201197
// Checker runtime failures
202198
TypeAlreadyAnnotatedFailure,
203-
TypeAnnotationExpectedFailure,
204199
CheckerImplementationFailure,
205200

206201
// Assets
207202
BadTokenName,
208-
DefineFTBadSignature,
209203
DefineNFTBadSignature,
210204
NoSuchNFT(String),
211205
NoSuchFT(String),
@@ -284,7 +278,6 @@ pub enum CheckErrors {
284278
IfArmsMustMatch(TypeSignature, TypeSignature),
285279
MatchArmsMustMatch(TypeSignature, TypeSignature),
286280
DefaultTypesMustMatch(TypeSignature, TypeSignature),
287-
TooManyExpressions,
288281
IllegalOrUnknownFunctionApplication(String),
289282
UnknownFunction(String),
290283

@@ -293,7 +286,6 @@ pub enum CheckErrors {
293286
TraitReferenceUnknown(String),
294287
TraitMethodUnknown(String, String),
295288
ExpectedTraitIdentifier,
296-
ImportTraitBadSignature,
297289
TraitReferenceNotAllowed,
298290
BadTraitImplementation(String, String),
299291
DefineTraitBadSignature,
@@ -499,7 +491,6 @@ fn formatted_expected_types(expected_types: &[TypeSignature]) -> String {
499491
impl DiagnosableError for CheckErrors {
500492
fn message(&self) -> String {
501493
match &self {
502-
CheckErrors::ExpectedLiteral => "expected a literal argument".into(),
503494
CheckErrors::SupertypeTooLarge => "supertype of two types is too large".into(),
504495
CheckErrors::Expects(s) => format!("unexpected interpreter behavior: {s}"),
505496
CheckErrors::BadMatchOptionSyntax(source) =>
@@ -510,7 +501,6 @@ impl DiagnosableError for CheckErrors {
510501
source.message()),
511502
CheckErrors::BadMatchInput(t) =>
512503
format!("match requires an input of either a response or optional, found input: '{t}'"),
513-
CheckErrors::TypeAnnotationExpectedFailure => "analysis expected type to already be annotated for expression".into(),
514504
CheckErrors::CostOverflow => "contract execution cost overflowed cost counter".into(),
515505
CheckErrors::CostBalanceExceeded(a, b) => format!("contract execution cost exceeded budget: {a:?} > {b:?}"),
516506
CheckErrors::MemoryBalanceExceeded(a, b) => format!("contract execution cost exceeded memory budget: {a:?} > {b:?}"),
@@ -521,12 +511,9 @@ impl DiagnosableError for CheckErrors {
521511
CheckErrors::ValueOutOfBounds => "created a type which value size was out of defined bounds".into(),
522512
CheckErrors::TypeSignatureTooDeep => "created a type which was deeper than maximum allowed type depth".into(),
523513
CheckErrors::ExpectedName => "expected a name argument to this function".into(),
524-
CheckErrors::NoSuperType(a, b) => format!("unable to create a supertype for the two types: '{a}' and '{b}'"),
525-
CheckErrors::UnknownListConstructionFailure => "invalid syntax for list definition".into(),
526514
CheckErrors::ListTypesMustMatch => "expecting elements of same type in a list".into(),
527515
CheckErrors::ConstructedListTooLarge => "reached limit of elements in a sequence".into(),
528516
CheckErrors::TypeError(expected_type, found_type) => format!("expecting expression of type '{expected_type}', found '{found_type}'"),
529-
CheckErrors::TypeLiteralError(expected_type, found_type) => format!("expecting a literal of type '{expected_type}', found '{found_type}'"),
530517
CheckErrors::TypeValueError(expected_type, found_value) => format!("expecting expression of type '{expected_type}', found '{found_value}'"),
531518
CheckErrors::UnionTypeError(expected_types, found_type) => format!("expecting expression of type {}, found '{}'", formatted_expected_types(expected_types), found_type),
532519
CheckErrors::UnionTypeValueError(expected_types, found_type) => format!("expecting expression of type {}, found '{}'", formatted_expected_types(expected_types), found_type),
@@ -591,21 +578,18 @@ impl DiagnosableError for CheckErrors {
591578
CheckErrors::IfArmsMustMatch(type_1, type_2) => format!("expression types returned by the arms of 'if' must match (got '{type_1}' and '{type_2}')"),
592579
CheckErrors::MatchArmsMustMatch(type_1, type_2) => format!("expression types returned by the arms of 'match' must match (got '{type_1}' and '{type_2}')"),
593580
CheckErrors::DefaultTypesMustMatch(type_1, type_2) => format!("expression types passed in 'default-to' must match (got '{type_1}' and '{type_2}')"),
594-
CheckErrors::TooManyExpressions => "reached limit of expressions".into(),
595581
CheckErrors::IllegalOrUnknownFunctionApplication(function_name) => format!("use of illegal / unresolved function '{function_name}"),
596582
CheckErrors::UnknownFunction(function_name) => format!("use of unresolved function '{function_name}'"),
597583
CheckErrors::TraitBasedContractCallInReadOnly => "use of trait based contract calls are not allowed in read-only context".into(),
598584
CheckErrors::WriteAttemptedInReadOnly => "expecting read-only statements, detected a writing operation".into(),
599585
CheckErrors::AtBlockClosureMustBeReadOnly => "(at-block ...) closures expect read-only statements, but detected a writing operation".into(),
600586
CheckErrors::BadTokenName => "expecting an token name as an argument".into(),
601-
CheckErrors::DefineFTBadSignature => "(define-token ...) expects a token name as an argument".into(),
602587
CheckErrors::DefineNFTBadSignature => "(define-asset ...) expects an asset name and an asset identifier type signature as arguments".into(),
603588
CheckErrors::NoSuchNFT(asset_name) => format!("tried to use asset function with a undefined asset ('{asset_name}')"),
604589
CheckErrors::NoSuchFT(asset_name) => format!("tried to use token function with a undefined token ('{asset_name}')"),
605590
CheckErrors::NoSuchTrait(contract_name, trait_name) => format!("use of unresolved trait {contract_name}.{trait_name}"),
606591
CheckErrors::TraitReferenceUnknown(trait_name) => format!("use of undeclared trait <{trait_name}>"),
607592
CheckErrors::TraitMethodUnknown(trait_name, func_name) => format!("method '{func_name}' unspecified in trait <{trait_name}>"),
608-
CheckErrors::ImportTraitBadSignature => "(use-trait ...) expects a trait name and a trait identifier".into(),
609593
CheckErrors::BadTraitImplementation(trait_name, func_name) => format!("invalid signature for method '{func_name}' regarding trait's specification <{trait_name}>"),
610594
CheckErrors::ExpectedTraitIdentifier => "expecting expression of type trait identifier".into(),
611595
CheckErrors::UnexpectedTraitOrFieldReference => "unexpected use of trait reference or field".into(),

clarity-types/src/types/signatures.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -977,8 +977,7 @@ impl TypeSignature {
977977
///
978978
/// The behavior varies by epoch:
979979
/// - Epoch 2.0/2.05: Uses [`TypeSignature::least_supertype_v2_0`]
980-
/// - Epoch 2.1+: Uses [`TypeSignature::least_supertype_v2_1`],
981-
/// Adds support for CallableTypes and ListUnionTypes
980+
/// - Epoch 2.1+: Uses [`TypeSignature::least_supertype_v2_1`], Adds support for CallableTypes and ListUnionTypes
982981
///
983982
/// For two Tuples:
984983
/// least_supertype(A, B) := (tuple \for_each(key k) least_supertype(type_a_k, type_b_k))

0 commit comments

Comments
 (0)