Skip to content

Commit

Permalink
Allow overload inference for polymorphic operators
Browse files Browse the repository at this point in the history
  • Loading branch information
glopesdev committed Mar 17, 2023
1 parent 5c9c041 commit 5ac597a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Bonsai.Design/TypeMappingEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,16 @@ public override object EditValue(ITypeDescriptorContext context, IServiceProvide
var intersection = default(HashSet<Type>);
foreach (var successor in builderNode.Successors)
{
var combinatorBuilder = ExpressionBuilder.Unwrap(successor.Target.Value) as CombinatorBuilder;
if (combinatorBuilder == null || combinatorBuilder.Combinator == null) continue;
var combinator = ExpressionBuilder.Unwrap(successor.Target.Value) switch
{
CombinatorBuilder combinatorBuilder => combinatorBuilder.Combinator,
ICustomTypeDescriptor typeDescriptor =>
TypeDescriptor.GetDefaultProperty(typeDescriptor.GetType())?.GetValue(typeDescriptor),
_ => null
};

var inputTypes = from method in GetProcessMethods(combinatorBuilder.Combinator.GetType())
if (combinator == null) continue;
var inputTypes = from method in GetProcessMethods(combinator.GetType())
where !method.IsGenericMethod
let parameters = method.GetParameters()
where parameters.Length > successor.Label.Index &&
Expand Down

0 comments on commit 5ac597a

Please sign in to comment.