From 9326493dddb036b7e2e8f443112b8e524f3fd361 Mon Sep 17 00:00:00 2001 From: effectfully Date: Mon, 20 May 2024 20:49:16 +0200 Subject: [PATCH] [Refactoring] Remove 'UnknownBuiltin' and 'UnknownBuiltinType' (#6064) --- .../20240520_192738_effectfully_remove_UnknownBuiltin.md | 3 +++ plutus-core/plutus-core/src/PlutusCore/Error.hs | 5 +---- .../src/PlutusCore/Evaluation/Machine/Exception.hs | 3 --- 3 files changed, 4 insertions(+), 7 deletions(-) create mode 100644 plutus-core/changelog.d/20240520_192738_effectfully_remove_UnknownBuiltin.md diff --git a/plutus-core/changelog.d/20240520_192738_effectfully_remove_UnknownBuiltin.md b/plutus-core/changelog.d/20240520_192738_effectfully_remove_UnknownBuiltin.md new file mode 100644 index 00000000000..5fe160f9919 --- /dev/null +++ b/plutus-core/changelog.d/20240520_192738_effectfully_remove_UnknownBuiltin.md @@ -0,0 +1,3 @@ +### Removed + +- `UnknownBuiltin` and `UnknownBuiltinType` in #6064. diff --git a/plutus-core/plutus-core/src/PlutusCore/Error.hs b/plutus-core/plutus-core/src/PlutusCore/Error.hs index 7b4b1e8d42a..7ec30398602 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Error.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Error.hs @@ -55,8 +55,7 @@ throwingEither r e = case e of -- | An error encountered during parsing. data ParserError - = UnknownBuiltinType !T.Text !SourcePos - | BuiltinTypeNotAStar !T.Text !SourcePos + = BuiltinTypeNotAStar !T.Text !SourcePos | UnknownBuiltinFunction !T.Text !SourcePos ![T.Text] | InvalidBuiltinConstant !T.Text !T.Text !SourcePos deriving stock (Eq, Ord, Generic) @@ -171,8 +170,6 @@ instance Pretty SourcePos where pretty = pretty . sourcePosPretty instance Pretty ParserError where - pretty (UnknownBuiltinType s loc) = - "Unknown built-in type" <+> squotes (pretty s) <+> "at" <+> pretty loc pretty (BuiltinTypeNotAStar ty loc) = "Expected a type of kind star (to later parse a constant), but got:" <+> squotes (pretty ty) <+> "at" <+> pretty loc diff --git a/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/Exception.hs b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/Exception.hs index 2ffd78de907..354750cc82c 100644 --- a/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/Exception.hs +++ b/plutus-core/plutus-core/src/PlutusCore/Evaluation/Machine/Exception.hs @@ -60,7 +60,6 @@ data MachineError fun -- ^ A builtin expected a term argument, but something else was received | UnexpectedBuiltinTermArgumentMachineError -- ^ A builtin received a term argument when something else was expected - | UnknownBuiltin fun | NonConstrScrutinized | MissingCaseBranch Word64 deriving stock (Show, Eq, Functor, Generic) @@ -139,8 +138,6 @@ instance (HasPrettyDefaults config ~ 'True, Pretty fun) => "A builtin received a term argument when something else was expected" prettyBy _ (UnliftingMachineError unliftingError) = pretty unliftingError - prettyBy _ (UnknownBuiltin fun) = - "Encountered an unknown built-in function:" <+> pretty fun prettyBy _ NonConstrScrutinized = "A non-constructor value was scrutinized in a case expression" prettyBy _ (MissingCaseBranch i) =