mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Improve expression type checking
This commit is contained in:
parent
b636d9ed71
commit
98ba7d467a
11 changed files with 160 additions and 55 deletions
7
tests/sample_errors/expr_cast_needed.blp
Normal file
7
tests/sample_errors/expr_cast_needed.blp
Normal file
|
@ -0,0 +1,7 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
template GtkListItem {
|
||||
Label {
|
||||
label: bind GtkListItem.item.label;
|
||||
}
|
||||
}
|
1
tests/sample_errors/expr_cast_needed.err
Normal file
1
tests/sample_errors/expr_cast_needed.err
Normal file
|
@ -0,0 +1 @@
|
|||
5,34,5,Could not determine the type of the preceding expression
|
5
tests/samples/expr_closure_args.blp
Normal file
5
tests/samples/expr_closure_args.blp
Normal file
|
@ -0,0 +1,5 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
Label {
|
||||
label: bind $my-closure (true, 10, "Hello") as (string);
|
||||
}
|
13
tests/samples/expr_closure_args.ui
Normal file
13
tests/samples/expr_closure_args.ui
Normal 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>
|
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue