mirror of
https://github.com/apple/pkl.git
synced 2026-05-25 16:19:20 +02:00
Fix module reflection when instrumentation is active (#1464)
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import "pkl:reflect"
|
||||
import "pkl:test"
|
||||
|
||||
class Foo {
|
||||
bar: String(startsWith("a"))
|
||||
}
|
||||
|
||||
// regression test for VmTyped.getImports()
|
||||
// which walks module members that are imports and casts their bodies to ImportNode
|
||||
// the catch activates instrumentation by failing a constraint check
|
||||
// so that the reflected import member bodies are wrapper nodes instead of ImportNode directly
|
||||
// the fix for this unwraps the wrapper before casting to ImportNode
|
||||
foo =
|
||||
let (_ = test.catchOrNull(() -> new Foo { bar = "baz" }.bar))
|
||||
reflect.Module(module).imports
|
||||
@@ -0,0 +1 @@
|
||||
foo = Map("reflect", "pkl:reflect", "test", "pkl:test")
|
||||
Reference in New Issue
Block a user