Skip to content

Commit 4b5c5d0

Browse files
committed
Fix compiling class loader
1 parent 2f72f43 commit 4b5c5d0

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ After adding the compiler to your project via `composer require xp-framework/com
1616

1717
Example
1818
-------
19-
The following code uses Hack language, PHP 8.4, PHP 8.3, PHP 8.2, 8.1 and 8.0 features but runs on anything >= PHP 7.4. Builtin features from newer PHP versions are translated to work with the currently executing runtime if necessary.
19+
The following code uses Hack language, PHP 8.6, PHP 8.5, PHP 8.4, PHP 8.3, PHP 8.2, 8.1 and 8.0 features but runs on anything >= PHP 7.4. Builtin features from newer PHP versions are translated to work with the currently executing runtime if necessary.
2020

2121
```php
2222
<?php // In a file "HelloWorld.php"
@@ -34,7 +34,8 @@ class HelloWorld {
3434
$greet= fn($to, $from) => self::GREETING.' '.$to.' from '.$from;
3535
$author= Reflection::type(self::class)->annotation(Author::class)->argument(0);
3636

37-
Console::writeLine(new Date()->toString(), ': ', $greet($args[0] ?? 'World', from: $author));
37+
Console::writeLine(new Date()->toString(), ': ');
38+
$greet($args[0] ?? 'World', from: $author) |> Console::writeLine(?);
3839
}
3940
}
4041
```

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
use lang\ast\emit\Reflection;
44
use lang\ast\emit\php\XpMeta;
5+
use lang\ast\nodes\Placeholder;
56
use lang\{
67
ClassFormatException,
78
ClassLoader,
@@ -23,6 +24,7 @@ class CompilingClassLoader implements IClassLoader {
2324
static function __static() {
2425

2526
// See https://github.com/xp-framework/compiler/issues/122
27+
Placeholder::__static();
2628
Reflection::__static();
2729
}
2830

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,15 @@ public function to_callable_new() {
5656
}
5757

5858
#[Test]
59-
public function to_partial_function_application() {
59+
public function to_partial_function_application_first() {
60+
Assert::equals(
61+
'\Console::writeLine("hi");',
62+
$this->emit('"hi" |> Console::writeLine(?);')
63+
);
64+
}
65+
66+
#[Test]
67+
public function to_partial_function_application_last() {
6068
Assert::equals(
6169
'str_replace("hi","hello","hi");',
6270
$this->emit('"hi" |> str_replace("hi", "hello", ?);')

0 commit comments

Comments
 (0)