mirror of
https://github.com/apple/pkl.git
synced 2026-09-13 13:21:47 +02:00
Fix reflect crash on modules using glob imports (#1816)
This excludes glob imports when creating a module's mirror
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import "pkl:reflect"
|
||||
import* "../../input-helper/globtest/child/*.pkl" as globbed
|
||||
|
||||
// regression test for VmTyped.getImports()
|
||||
// `member.isImport()` is true for glob imports too, so reflecting a module that
|
||||
// uses `import*` previously threw ClassCastException when casting the glob
|
||||
// import's body to ImportNode.
|
||||
// Glob imports resolve to a mapping rather than a module type, so they are
|
||||
// excluded from `imports` (which only reports regular imports).
|
||||
res = reflect.Module(module).imports
|
||||
|
||||
// the glob import itself still works
|
||||
globbedKeys = globbed.keys.toListing()
|
||||
@@ -0,0 +1,4 @@
|
||||
res = Map("reflect", "pkl:reflect")
|
||||
globbedKeys {
|
||||
"../../input-helper/globtest/child/moduleC.pkl"
|
||||
}
|
||||
Reference in New Issue
Block a user