Skip to content

Commit e2b6078

Browse files
committed
Fix lambdas without braces as arguments
1 parent bb128e3 commit e2b6078

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/main/php/lang/ast/Parse.class.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ private function setup() {
9696
$signature= [[[$left->value, false, null, false, false, null]], null];
9797
$node->value= [$signature, $this->expression(0)];
9898
$node->arity= 'lambda';
99-
$this->token= new Node($this->symbol(';'));
10099
return $node;
101100
});
102101

src/test/php/lang/ast/unittest/emit/LambdasTest.class.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,18 @@ public function run() {
107107
$this->assertEquals(2, $r(1));
108108
}
109109

110+
#[@test]
111+
public function without_braces_as_argument() {
112+
$r= $this->run('class <T> {
113+
private function apply($f, ... $args) { return $f(...$args); }
114+
public function run() {
115+
return $this->apply($a ==> $a + 1, 2);
116+
}
117+
}');
118+
119+
$this->assertEquals(3, $r);
120+
}
121+
110122
#[@test]
111123
public function without_params() {
112124
$r= $this->run('class <T> {

0 commit comments

Comments
 (0)