From f828f47c616ce20ed60e589a01d61d02bb421730 Mon Sep 17 00:00:00 2001 From: Pieter12345 Date: Fri, 27 Dec 2024 02:47:37 +0100 Subject: [PATCH] Change closure return type instanceof check to cached variant --- src/main/java/com/laytonsmith/core/constructs/CClosure.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/laytonsmith/core/constructs/CClosure.java b/src/main/java/com/laytonsmith/core/constructs/CClosure.java index d0466ef03..910e4f698 100644 --- a/src/main/java/com/laytonsmith/core/constructs/CClosure.java +++ b/src/main/java/com/laytonsmith/core/constructs/CClosure.java @@ -294,7 +294,7 @@ protected void execute(Mixed... values) throws ConfigRuntimeException, ProgramFl // Check the return type of the closure to see if it matches the defined type // Normal execution. Mixed ret = ex.getReturn(); - if(!InstanceofUtil.isInstanceof(ret, returnType, environment)) { + if(!InstanceofUtil.isInstanceof(ret.typeof(), returnType, environment)) { throw new CRECastException("Expected closure to return a value of type " + returnType.val() + " but a value of type " + ret.typeof() + " was returned instead", ret.getTarget()); }