Skip to content

Commit

Permalink
Fix ClassCastException when reflecting on globbed import
Browse files Browse the repository at this point in the history
  • Loading branch information
odenix authored and bioball committed May 28, 2024
1 parent 5b9e27d commit f307a45
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkl-core/src/main/java/org/pkl/core/runtime/VmTyped.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.pkl.core.Composite;
import org.pkl.core.PModule;
import org.pkl.core.PObject;
import org.pkl.core.ast.expression.unary.ImportNode;
import org.pkl.core.ast.expression.unary.AbstractImportNode;
import org.pkl.core.ast.member.ObjectMember;
import org.pkl.core.util.EconomicMaps;
import org.pkl.core.util.LateInit;
Expand Down Expand Up @@ -105,7 +105,7 @@ public VmMap getImports() {
assert memberNode != null; // import is never a constant
builder.add(
member.getName().toString(),
((ImportNode) memberNode.getBodyNode()).getImportUri().toString());
((AbstractImportNode) memberNode.getBodyNode()).getImportUri().toString());
}
}
return builder.build();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
amends ".../snippetTest.pkl"

import "pkl:reflect"
import* "reflect*.pkl"

local mod = reflect.Module(this)

examples {
["Reflecting globbed import"] {
mod.imports.keys == Set("reflect", "reflect*")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
examples {
["Reflecting globbed import"] {
true
}
}

0 comments on commit f307a45

Please sign in to comment.