Handle generic inheritance for checking if type is valid for function parameter

This commit is contained in:
Deukhoofd 2019-01-22 11:51:12 +01:00
parent a413c5ecd4
commit cd6384614b
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
1 changed files with 8 additions and 1 deletions

View File

@ -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;