diff --git a/guppylang/checker/errors/type_errors.py b/guppylang/checker/errors/type_errors.py index df7d771b..dddd94c7 100644 --- a/guppylang/checker/errors/type_errors.py +++ b/guppylang/checker/errors/type_errors.py @@ -74,7 +74,7 @@ class TypeInferenceError(Error): @dataclass(frozen=True) class IllegalConstant(Error): title: ClassVar[str] = "Unsupported constant" - span_label: ClassVar[str] = "Type `{ty}` is not supported" + span_label: ClassVar[str] = "Type `{python_ty.__name__}` is not supported" python_ty: type diff --git a/tests/error/misc_errors/unsupported_const.err b/tests/error/misc_errors/unsupported_const.err new file mode 100644 index 00000000..baf3536d --- /dev/null +++ b/tests/error/misc_errors/unsupported_const.err @@ -0,0 +1,8 @@ +Error: Unsupported constant (at $FILE:7:8) + | +5 | @compile_guppy +6 | def foo() -> None: +7 | x = "foo" + | ^^^^^ Type `str` is not supported + +Guppy compilation failed due to 1 previous error diff --git a/tests/error/misc_errors/unsupported_const.py b/tests/error/misc_errors/unsupported_const.py new file mode 100644 index 00000000..1959d05b --- /dev/null +++ b/tests/error/misc_errors/unsupported_const.py @@ -0,0 +1,7 @@ +from guppylang.std.builtins import array +from tests.util import compile_guppy + + +@compile_guppy +def foo() -> None: + x = "foo"