diff --git a/compiler/test/stdlib/number.test.gr b/compiler/test/stdlib/number.test.gr index 1b22bf2e2f..62e3417307 100644 --- a/compiler/test/stdlib/number.test.gr +++ b/compiler/test/stdlib/number.test.gr @@ -601,11 +601,11 @@ assert Result.isErr(Number.parseInt("zzzzz", 9223372036854775807)) assert Result.isErr(Number.parseInt("10", 1.23)) assert Result.isErr(Number.parseInt("10", 2/3)) assert match (Number.parseInt("zzzzz", 10)) { - Err(Number.PraseIntInvalidDigit) => true, + Err(Number.ParseIntInvalidDigit) => true, _ => false, } assert match (Number.parseInt("", 10)) { - Err(Number.PraseIntEmptyString) => true, + Err(Number.ParseIntEmptyString) => true, _ => false, } assert match (Number.parseInt("10", 2/3)) { diff --git a/stdlib/number.gr b/stdlib/number.gr index a300f28e45..9539dbba23 100644 --- a/stdlib/number.gr +++ b/stdlib/number.gr @@ -31,14 +31,14 @@ include "runtime/unsafe/tags" include "runtime/exception" from Atoi use { - exception PraseIntEmptyString, - exception PraseIntInvalidDigit, + exception ParseIntEmptyString, + exception ParseIntInvalidDigit, exception ParseIntInvalidRadix, } provide { - exception PraseIntEmptyString, - exception PraseIntInvalidDigit, + exception ParseIntEmptyString, + exception ParseIntInvalidDigit, exception ParseIntInvalidRadix, } /** diff --git a/stdlib/runtime/atoi/parse.gr b/stdlib/runtime/atoi/parse.gr index 885e601ba5..e5cdcacaea 100644 --- a/stdlib/runtime/atoi/parse.gr +++ b/stdlib/runtime/atoi/parse.gr @@ -25,13 +25,13 @@ from Numbers use { reducedInteger } * * @since v0.6.0 */ -provide exception PraseIntEmptyString +provide exception ParseIntEmptyString /** * Represents an error caused by trying to parse a string with an invalid character. * * @since v0.6.0 */ -provide exception PraseIntInvalidDigit +provide exception ParseIntInvalidDigit /** * Represents an error caused by trying to parse with an invalid radix. * @@ -81,7 +81,7 @@ provide let parseInt = (string: String, radix: Number) => { } if (WasmI32.eqz(strLen)) { - return Err(PraseIntEmptyString) + return Err(ParseIntEmptyString) } let mut char = WasmI32.load8U(offset, 0n) @@ -142,12 +142,12 @@ provide let parseInt = (string: String, radix: Number) => { c when c - _CHAR_A < 26n => digit = char - _CHAR_A + 10n, c when c - _CHAR_a < 26n => digit = char - _CHAR_a + 10n, _ => { - return Err(PraseIntInvalidDigit) + return Err(ParseIntInvalidDigit) }, } if (digit >= WasmI32.wrapI64(radix)) { - return Err(PraseIntInvalidDigit) + return Err(ParseIntInvalidDigit) } let digit = WasmI64.extendI32U(digit) @@ -193,7 +193,7 @@ provide let parseInt = (string: String, radix: Number) => { } from WasmI64 use { (*) } // TODO: Verify this is suitable for handling "_" - if (WasmI32.eqz(sawDigit)) return Err(PraseIntInvalidDigit) + if (WasmI32.eqz(sawDigit)) return Err(ParseIntInvalidDigit) if (WasmI32.eqz(isBigInt)) { let value = if (negative) value else value * -1N