You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2025/10/20 21:47:14 UTC

(royale-compiler) 01/02: MethodBodySemanticChecker: added missing strict function types check for values of return statements

This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit f0bf881b1291982c5aeb5ed4a6bb39426e99ac1a
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Mon Oct 20 14:45:35 2025 -0700

    MethodBodySemanticChecker: added missing strict function types check for values of return statements
---
 .../compiler/internal/semantics/MethodBodySemanticChecker.java       | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/semantics/MethodBodySemanticChecker.java b/compiler/src/main/java/org/apache/royale/compiler/internal/semantics/MethodBodySemanticChecker.java
index 051838c80..f0c995871 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/semantics/MethodBodySemanticChecker.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/semantics/MethodBodySemanticChecker.java
@@ -2660,6 +2660,11 @@ public class MethodBodySemanticChecker
                 }
                 else
                 {
+                    if (project.getAllowStrictFunctionTypes() && project.getBuiltinType(BuiltinType.FUNCTION).equals(return_type))
+                    {
+                        IMetaTag expectedFunctionTypeMeta = func_def.getMetaTagByName(IMetaAttributeConstants.ATTRIBUTE_FUNCTION_TYPE);
+                        checkFunctionTypeMeta(expectedFunctionTypeMeta, iNode, returnExpression);
+                    }
                     checkImplicitConversion(returnExpression, return_type, null);
                 }