diff --git a/CLanguage/Interpreter/FunctionContext.cs b/CLanguage/Interpreter/FunctionContext.cs index 6a64c33..4e75051 100644 --- a/CLanguage/Interpreter/FunctionContext.cs +++ b/CLanguage/Interpreter/FunctionContext.cs @@ -77,7 +77,7 @@ public override ResolvedVariable ResolveVariable (string name, CType[] argTypes) for (var i = 0; i < exe.Functions.Count; i++) { var f = exe.Functions[i]; if (f.Name == name && string.IsNullOrEmpty (f.NameContext)) { - var score = f.FunctionType.ScoreParameterTypesMatches (argTypes); + var score = f.FunctionType.ScoreParameterTypeMatches (argTypes); if (score > fs) { ff = f; fi = i; diff --git a/CLanguage/Syntax/FuncallExpression.cs b/CLanguage/Syntax/FuncallExpression.cs index 4732915..855998d 100644 --- a/CLanguage/Syntax/FuncallExpression.cs +++ b/CLanguage/Syntax/FuncallExpression.cs @@ -100,7 +100,7 @@ Overload ResolveOverload (Expression function, CType[] argTypes, EmitContext ec) var methodq = from m in methods let mt = m.MemberType as CFunctionType where mt != null - let score = mt.ScoreParameterTypesMatches (argTypes) + let score = mt.ScoreParameterTypeMatches (argTypes) where score > 0 orderby score descending select m; diff --git a/CLanguage/Types/CFunctionType.cs b/CLanguage/Types/CFunctionType.cs index ec2d9dd..2f7308d 100644 --- a/CLanguage/Types/CFunctionType.cs +++ b/CLanguage/Types/CFunctionType.cs @@ -75,7 +75,7 @@ public override string ToString() return s; } - public int ScoreParameterTypesMatches (CType[] argTypes) + public int ScoreParameterTypeMatches (CType[] argTypes) { if (argTypes == null) return 1; @@ -83,7 +83,7 @@ public int ScoreParameterTypesMatches (CType[] argTypes) if (Parameters.Count != argTypes.Length) return 0; - var score = 1; + var score = 2; for (var i = 0; i < Parameters.Count; i++) { var ft = argTypes[i];