Skip to content

Commit f828f47

Browse files
committed
Change closure return type instanceof check to cached variant
1 parent 1c47d1a commit f828f47

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/laytonsmith/core/constructs/CClosure.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ protected void execute(Mixed... values) throws ConfigRuntimeException, ProgramFl
294294
// Check the return type of the closure to see if it matches the defined type
295295
// Normal execution.
296296
Mixed ret = ex.getReturn();
297-
if(!InstanceofUtil.isInstanceof(ret, returnType, environment)) {
297+
if(!InstanceofUtil.isInstanceof(ret.typeof(), returnType, environment)) {
298298
throw new CRECastException("Expected closure to return a value of type " + returnType.val()
299299
+ " but a value of type " + ret.typeof() + " was returned instead", ret.getTarget());
300300
}

0 commit comments

Comments
 (0)