diff --git a/blueprintcompiler/language/values.py b/blueprintcompiler/language/values.py index 63cf4fc..5f47e54 100644 --- a/blueprintcompiler/language/values.py +++ b/blueprintcompiler/language/values.py @@ -452,6 +452,14 @@ class ArrayValue(AstNode): range=quoted_literal.range, ) ) + elif isinstance(value.child, Translated): + errors.append( + CompileError( + "Arrays can't contain translated strings", + range=value.child.range, + ) + ) + if len(errors) > 0: raise MultipleErrors(errors) diff --git a/tests/sample_errors/translated_string_array.blp b/tests/sample_errors/translated_string_array.blp new file mode 100644 index 0000000..451d900 --- /dev/null +++ b/tests/sample_errors/translated_string_array.blp @@ -0,0 +1,7 @@ +using Gtk 4.0; + +StringList { + strings: [ + _("Test") + ]; +} diff --git a/tests/sample_errors/translated_string_array.err b/tests/sample_errors/translated_string_array.err new file mode 100644 index 0000000..0beb7e5 --- /dev/null +++ b/tests/sample_errors/translated_string_array.err @@ -0,0 +1 @@ +5,5,9,Arrays can't contain translated strings \ No newline at end of file