Skip to content

Commit 74dbd0e

Browse files
committed
done
1 parent 418cbf2 commit 74dbd0e

File tree

1 file changed

+4
-1
lines changed
  • plutus-core/plutus-core/src/PlutusCore/Parser

1 file changed

+4
-1
lines changed

plutus-core/plutus-core/src/PlutusCore/Parser/Type.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@ defaultUni = do
154154
, try $ someType @_ @BLS12_381.G2.Element <$ symbol "bls12_381_G2_element"
155155
, try $ someType @_ @BLS12_381.Pairing.MlResult <$ symbol "bls12_381_mlresult"
156156
, try $ someType @_ @Value <$ symbol "value"
157-
, fail "Unknown type, expected one of: bool, integer, bytestring, string, unit, list, array, pair, data, value, bls12_381_G1_element, bls12_381_G2_element, bls12_381_mlresult, or a type application in parens"
157+
, -- We include an explicit failure case here to produce clearer error messages.
158+
-- Without this, using `choice` with `symbol` results in error messages that cover the longest possible SrcSpan,
159+
-- which in this context would be 20 characters spanning the entire "bls12_381_G2_element" token.
160+
fail "Unknown type, expected one of: bool, integer, bytestring, string, unit, list, array, pair, data, value, bls12_381_G1_element, bls12_381_G2_element, bls12_381_mlresult, or a type application in parens"
158161
]
159162

160163
tyName :: Parser TyName

0 commit comments

Comments
 (0)