Skip to content

Commit 8f7502a

Browse files
committed
Align gdtoolkit to typed array type testing
1 parent c9bf2ee commit 8f7502a

File tree

6 files changed

+13
-5
lines changed

6 files changed

+13
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
### Changed
1717
- Removed support for legacy (Godot `3.x`) GDScript from core testcases
18-
- Updated `lark` dependency to the latest release - `0.12.0`
18+
- Updated `lark` dependency to the latest release - `1.1.5`
1919
- Improved `subscr_expr`/`getattr`/`getattr_call` chains formatting
2020

2121
## [3.4.0] 2022-04-21

gdtoolkit/parser/gdscript.lark

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ assnmnt_expr: attr_expr _assnmnt_op type_cast
203203
!?asless_actual_bitw_not: "~" asless_bitw_not
204204
?asless_bitw_not: asless_type_test
205205
| asless_actual_bitw_not
206-
!?type_test: await_expr ("is" TYPE)*
207-
| actual_type_cast ("is" TYPE)+
208-
!?asless_type_test: await_expr ("is" TYPE)*
206+
!?type_test: await_expr ("is" TYPE_HINT)*
207+
| actual_type_cast ("is" TYPE_HINT)+
208+
!?asless_type_test: await_expr ("is" TYPE_HINT)*
209209
!?await_expr: ("await")* call_expr
210210
?call_expr: attr_expr
211211
| NAME _call_arglist -> standalone_call

tests/formatter/input-output-pairs/type-test-expressions.in.gd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ class X:
22
func foo():
33
var x = 1 is int is bool
44
var y = 1 is int is bool is bool is bool is bool is bool is bool is bool is bool is bool is bool is bool is bool is bool
5+
print([1,2.1] is Array[int])

tests/formatter/input-output-pairs/type-test-expressions.out.gd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ class X:
1818
is bool
1919
is bool
2020
)
21+
print([1, 2.1] is Array[int])

tests/valid-gd-scripts/expressions.gd

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
extends Node
22

3+
enum Xyz { AAA }
4+
35
const XXXX = preload('functions.gd')
46

7+
class Zyx:
8+
enum Qwe { BBB }
9+
510
class XNode extends Node:
611
class YNode extends Node:
712
pass
@@ -38,7 +43,8 @@ func foo():
3843
-8
3944
~8
4045
x is int
41-
x is x.Type
46+
x is Xyz # TODO: fix/remove x.Type
47+
x is Zyx.Qwe # TODO: fix/remove x.Type
4248
x.attr
4349
x[10]
4450
bar()

0 commit comments

Comments
 (0)