From: Florian Brosch Date: Tue, 2 Sep 2014 23:37:31 +0000 (+0200) Subject: vala: Improve error message for arrays as type arguments X-Git-Tag: 0.44.10~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe7c88fe4360084ad0f239413057f6671c9b422f;p=thirdparty%2Fvala.git vala: Improve error message for arrays as type arguments --- diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index 776562087..54bf70bc5 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -4688,6 +4688,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator { if (delegate_type.delegate_symbol.has_target) { Report.error (type_arg.source_reference, "Delegates with target are not supported as generic type arguments"); } + } else if (type_arg is ArrayType) { + Report.error (type_arg.source_reference, "Arrays are not supported as generic type arguments"); } else { Report.error (type_arg.source_reference, "`%s' is not a supported generic type argument, use `?' to box value types".printf (type_arg.to_string ())); } diff --git a/tests/Makefile.am b/tests/Makefile.am index 6cc135dac..d802cbc7a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -484,6 +484,7 @@ TESTS = \ asynchronous/variadic-invalid.test \ asynchronous/variadic-invalid-2.test \ asynchronous/yield.vala \ + generics/arrays-not-supported.test \ generics/constructor-chain-up.vala \ generics/inference-static-function.vala \ generics/parameter-sizeof-initializer.vala \ diff --git a/tests/generics/arrays-not-supported.test b/tests/generics/arrays-not-supported.test new file mode 100644 index 000000000..39bce9001 --- /dev/null +++ b/tests/generics/arrays-not-supported.test @@ -0,0 +1,8 @@ +Invalid Code + +void foo(G g = null) { +} + +void main () { + foo(); +}