basic-types/custom-types.vala \
basic-types/default-gtype.vala \
basic-types/strings.vala \
+ basic-types/string-concat-null.test \
basic-types/arrays.vala \
basic-types/arrays-generics.vala \
basic-types/arrays-fixed-assignment.vala \
--- /dev/null
+Invalid Code
+
+void main () {
+ var str = "foo" + null + "bar";
+}
assert (t == s);
}
+void test_string_concat () {
+ var s = "hello" + "world";
+ assert (s == "helloworld");
+}
+
void test_string_joinv () {
string[] sa = { "hello", "my", "world" };
void main () {
test_string ();
+ test_string_concat ();
test_string_joinv ();
test_string_printf ();
test_string_replace ();
&& left.value_type.compatible (context.analyzer.string_type)) {
// string concatenation
- if (right.value_type == null || !right.value_type.compatible (context.analyzer.string_type)) {
+ if (right.value_type == null || !right.value_type.compatible (context.analyzer.string_type)
+ || left is NullLiteral || right is NullLiteral) {
+ // operands cannot be null
error = true;
Report.error (source_reference, "Operands must be strings");
return false;