From cd6384614b0982cd3b4b4b5577761637ed6a2125 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Tue, 22 Jan 2019 11:51:12 +0100 Subject: [PATCH] Handle generic inheritance for checking if type is valid for function parameter --- .../BaseTypes/ScriptFunction/ScriptRuntimeFunction.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Upsilon/BaseTypes/ScriptFunction/ScriptRuntimeFunction.cs b/Upsilon/BaseTypes/ScriptFunction/ScriptRuntimeFunction.cs index a21e39e..d409cef 100644 --- a/Upsilon/BaseTypes/ScriptFunction/ScriptRuntimeFunction.cs +++ b/Upsilon/BaseTypes/ScriptFunction/ScriptRuntimeFunction.cs @@ -56,7 +56,14 @@ namespace Upsilon.BaseTypes.ScriptFunction { var validSymbol = parameterSymbol.BoundTypeDefinition.ValidInternalTypes.Any(validType => - validType.IsAssignableFrom(parameterType)); + { + var b = validType.IsAssignableFrom(parameterType); + if (b) return true; + if (parameterType.IsGenericType && + validType.IsAssignableFrom(parameterType.GetGenericTypeDefinition())) + return true; + return false; + }); if (!validSymbol) { isCompatible = false;