Improve expression type checking

This commit is contained in:
James Westman 2023-03-12 15:35:05 -05:00
parent b636d9ed71
commit 98ba7d467a
11 changed files with 160 additions and 55 deletions

View file

@ -0,0 +1,7 @@
using Gtk 4.0;
template GtkListItem {
Label {
label: bind GtkListItem.item.label;
}
}

View file

@ -0,0 +1 @@
5,34,5,Could not determine the type of the preceding expression

View file

@ -0,0 +1,5 @@
using Gtk 4.0;
Label {
label: bind $my-closure (true, 10, "Hello") as (string);
}

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<object class="GtkLabel">
<binding name="label">
<closure function="my-closure" type="gchararray">
<constant type="gboolean">true</constant>
<constant type="gint">10</constant>
<constant type="gchararray">Hello</constant>
</closure>
</binding>
</object>
</interface>

View file

@ -150,6 +150,9 @@ class TestSamples(unittest.TestCase):
self.assert_sample("comments")
self.assert_sample("enum")
self.assert_sample("expr_closure", skip_run=True) # The closure doesn't exist
self.assert_sample(
"expr_closure_args", skip_run=True
) # The closure doesn't exist
self.assert_sample("expr_lookup")
self.assert_sample("file_filter")
self.assert_sample("flags")
@ -208,6 +211,7 @@ class TestSamples(unittest.TestCase):
self.assert_sample_error("empty")
self.assert_sample_error("enum_member_dne")
self.assert_sample_error("expr_cast_conversion")
self.assert_sample_error("expr_cast_needed")
self.assert_sample_error("expr_closure_not_cast")
self.assert_sample_error("expr_lookup_dne")
self.assert_sample_error("expr_lookup_no_properties")