Permalink
Browse files

The score boost for a function declaration with no suffix when a call…

… has no suffix is now 1, while the type of a child class versus a parent class is now 2 units behind the score of the child class versus itself. Closes #418
  • Loading branch information...
alexnask committed Jun 7, 2012
1 parent 3bf2841 commit 4c1581c61cd9bf795ccee64c85b9c04cdc90418d
Showing with 5 additions and 2 deletions.
  1. +1 −1 source/rock/middle/BaseType.ooc
  2. +4 −1 source/rock/middle/FunctionCall.ooc
@@ -291,7 +291,7 @@ BaseType: class extends Type {
}
if(ourRef instanceOf?(TypeDecl) && hisRef instanceOf?(TypeDecl)) {
- inheritsScore := ourRef as TypeDecl inheritsScore(hisRef as TypeDecl, scoreSeed - 1)
+ inheritsScore := ourRef as TypeDecl inheritsScore(hisRef as TypeDecl, scoreSeed - 2)
// something needs resolving
if(inheritsScore == -1) {
@@ -1203,7 +1203,10 @@ FunctionCall: class extends Expression {
// even though an unsuffixed call could be a call
// to any of the suffixed versions, if both the call
// and the decl don't have a suffix, that's a good sign.
- score += Type SCORE_SEED / 4
+ // a slight boost of 1 should be enough to make rock use
+ // the correct version of a function with the same argument
+ // types and use the one declared with no suffix.
+ score += 1
}
if(declArgs getSize() == 0) return score

0 comments on commit 4c1581c

Please sign in to comment.