Handle binding of function parameter better, consider inheritance

This commit is contained in:
Deukhoofd 2019-02-16 18:39:04 +01:00
parent 73a0d64bed
commit d121bb2409
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
2 changed files with 11 additions and 1 deletions

View File

@ -2,7 +2,7 @@ using System;
namespace Upsilon.BaseTypes.UserData
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Interface)]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Interface, Inherited = false)]
public class UpsilonUserDataAttribute : Attribute
{
public UpsilonUserDataAttribute(string name)

View File

@ -46,9 +46,19 @@ namespace Upsilon.Binder.VariableSymbols
var userData = functionParameter.TypeContainer.UserData;
if (string.IsNullOrEmpty(userData))
continue;
if (!string.Equals(userData,
callingParameter.ValueType.UserData))
{
var boundFunctionType = BoundTypeHandler.GetTypeDefinition(userData).ValidInternalTypes.FirstOrDefault();
var boundCallingType =
BoundTypeHandler.GetTypeDefinition(callingParameter.ValueType.UserData);
if (boundCallingType.ValidInternalTypes.Contains(boundFunctionType))
{
continue;
}
isValid = false;
break;
}