Build failed
Hi! I can not build current github version successfully. The version AIIDE 2017 is ok, so I think I followed How to build correctly. There are 14 errors listed as follows. D:\Work\PurpleWave\src\Information\Economy.scala Error:(35, 100) type mismatch; found : ProxyBwapi.UnitInfo.UnitInfo required: ProxyBwapi.UnitInfo.FriendlyUnitInfo Error occurred in an application involving default arguments. private val ourActiveMinersCache = new Cache(() => With.units.countOurs(u => isActivelyMining(u) && u.gatheringMinerals)) Error:(36, 100) type mismatch; found : ProxyBwapi.UnitInfo.UnitInfo required: ProxyBwapi.UnitInfo.FriendlyUnitInfo Error occurred in an application involving default arguments. private val ourActiveDrillersCache = new Cache(() => With.units.countOurs(u => isActivelyMining(u) && u.gatheringGas)) D:\Work\PurpleWave\src\Information\Intelligenze\Fingerprinting\Generic\AbstractFingerprintQuantityBy.scala Error:(13, 16) ambiguous reference to overloaded definition, both method countEnemy in class UnitTracker of type (predicate: ProxyBwapi.UnitInfo.ForeignUnitInfo => Boolean)Int and method countEnemy in class UnitTracker of type (matcher: Planning.Composition.UnitMatchers.UnitMatcher*)Int match argument types (ProxyBwapi.UnitInfo.UnitInfo => Boolean) and expected result type Int With.units.countEnemy(u => D:\Work\PurpleWave\src\Micro\Actions\Combat\Tactics\Tickle.scala Error:(85, 36) ambiguous reference to overloaded definition, both method countOurs in class UnitTracker of type (predicate: ProxyBwapi.UnitInfo.FriendlyUnitInfo => Boolean)Int and method countOurs in class UnitTracker of type (matcher: Planning.Composition.UnitMatchers.UnitMatcher*)Int match argument types (ProxyBwapi.UnitInfo.UnitInfo => Boolean) val workersHere = With.units.countOurs(u => u.unitClass.isWorker && u.zone == zone) D:\Work\PurpleWave\src\Micro\Squads\Goals\GoalBasic.scala Warning:(80, 25) enclosing method offer has result type Unit: return value discarded if ( ! acceptsHelp) return Iterable.empty D:\Work\PurpleWave\src\Planning\Composition\UnitCounters\UnitCountExcept.scala Error:(9, 68) type mismatch; found : ProxyBwapi.UnitInfo.UnitInfo required: ProxyBwapi.UnitInfo.FriendlyUnitInfo val cap = With.units.countOurs(unit => With.recruiter.eligible(unit) && matcher.accept(unit)) D:\Work\PurpleWave\src\Planning\Plans\GamePlans\Zerg\ZvT\TwoHatchMuta.scala Error:(122, 20) ambiguous reference to overloaded definition, both method countOurs in class UnitTracker of type (predicate: ProxyBwapi.UnitInfo.FriendlyUnitInfo => Boolean)Int and method countOurs in class UnitTracker of type (matcher: Planning.Composition.UnitMatchers.UnitMatcher*)Int match argument types (ProxyBwapi.UnitInfo.UnitInfo => Boolean) Error occurred in an application involving default arguments. With.units.countOurs(_.gasLeft > 0)), D:\Work\PurpleWave\src\Planning\Plans\Macro\Automatic\AddAddons.scala Error:(11, 16) ambiguous reference to overloaded definition, both method countOurs in class UnitTracker of type (predicate: ProxyBwapi.UnitInfo.FriendlyUnitInfo => Boolean)Int and method countOurs in class UnitTracker of type (matcher: Planning.Composition.UnitMatchers.UnitMatcher*)Int match argument types (ProxyBwapi.UnitInfo.UnitInfo => Boolean) and expected result type Int With.units.countOurs(b => b.is(unitClass.whatBuilds.1) && b.addon.isEmpty) D:\Work\PurpleWave\src\Planning\Plans\Macro\Automatic\TrainContinuously.scala Error:(72, 37) value buildType is not a member of ProxyBwapi.UnitInfo.UnitInfo || (unit.is(Zerg.Egg) && unit.buildType == unitClass)) D:\Work\PurpleWave\src\Planning\Plans\Macro\Automatic\TrainDynamic.scala Error:(72, 37) value buildType is not a member of ProxyBwapi.UnitInfo.UnitInfo || (unit.is(Zerg.Egg) && unit.buildType == unitClass)) D:\Work\PurpleWave\src\Planning\Plans\Macro\Protoss\MeldArchons.scala Error:(21, 36) ambiguous reference to overloaded definition, both method countOurs in class UnitTracker of type (predicate: ProxyBwapi.UnitInfo.FriendlyUnitInfo => Boolean)Int and method countOurs in class UnitTracker of type (matcher: Planning.Composition.UnitMatchers.UnitMatcher*)Int match argument types (ProxyBwapi.UnitInfo.UnitInfo => Boolean) val templarLow = With.units.countOurs(u => u.is(Protoss.HighTemplar) && u.energy < maxEnergy) D:\Work\PurpleWave\src\Planning\Plans\Macro\Terran\BuildBunkersAtBases.scala Error:(42, 40) ambiguous reference to overloaded definition, both method countOurs in class UnitTracker of type (predicate: ProxyBwapi.UnitInfo.FriendlyUnitInfo => Boolean)Int and method countOurs in class UnitTracker of type (matcher: Planning.Composition.UnitMatchers.UnitMatcher*)Int match argument types (ProxyBwapi.UnitInfo.UnitInfo => Boolean) lazy val towersInZone = With.units.countOurs(u => u.is(Terran.Bunker) && u.zone == zone) D:\Work\PurpleWave\src\Planning\Plans\Macro\Terran\BuildMissileTurretsAtBases.scala Error:(34, 36) ambiguous reference to overloaded definition, both method countOurs in class UnitTracker of type (predicate: ProxyBwapi.UnitInfo.FriendlyUnitInfo => Boolean)Int and method countOurs in class UnitTracker of type (matcher: Planning.Composition.UnitMatchers.UnitMatcher*)Int match argument types (ProxyBwapi.UnitInfo.UnitInfo => Boolean) val turretsInBase = With.units.countOurs(unit => unit.is(Terran.MissileTurret) && unit.zone == zone) D:\Work\PurpleWave\src\Planning\Plans\Macro\Zerg\BuildZergStaticDefenseAtBases.scala Error:(44, 40) ambiguous reference to overloaded definition, both method countOurs in class UnitTracker of type (predicate: ProxyBwapi.UnitInfo.FriendlyUnitInfo => Boolean)Int and method countOurs in class UnitTracker of type (matcher: Planning.Composition.UnitMatchers.UnitMatcher*)Int match argument types (ProxyBwapi.UnitInfo.UnitInfo => Boolean) lazy val towersInZone = With.units.countOurs(unit => Vector(Zerg.CreepColony, towerClass).contains(unit.unitClass) && unit.zone == zone) D:\Work\PurpleWave\src\Planning\Plans\Predicates\Scenarios\WeAreBeingWorkerRushed.scala Error:(14, 16) ambiguous reference to overloaded definition, both method countEnemy in class UnitTracker of type (predicate: ProxyBwapi.UnitInfo.ForeignUnitInfo => Boolean)Int and method countEnemy in class UnitTracker of type (matcher: Planning.Composition.UnitMatchers.UnitMatcher*)Int match argument types (ProxyBwapi.UnitInfo.UnitInfo => Boolean) With.units.countEnemy(unit => unit.unitClass.isWorker && unit.zone.bases.exists(.owner.isUs)) >
Hi Leon! I can't reproduce the errors you're describing. My guess is that it's caused by a slightly different version of the Scala compiler.
Fortunately these should be easy to fix:
- In UnitTracker.scala give the overloads of countOurs and countEnemy different names
- Build, see what breaks due to the name change, then fix the errors by using the new names
I recommend trying this first by using IntellIJ's smart refactor (select the function name, then hit shift+F6). It might try renaming both overloads, in which case you'll have to do it by hand.
Actually, an even easier fix might be to simply delete the overloads which take a lambda as an argument:
def countOurs(predicate: (FriendlyUnitInfo) => Boolean): Int = counterOurs(predicate)
def countEnemy(predicate: (ForeignUnitInfo) => Boolean): Int = counterEnemy(predicate)
The whole reason the overload was necessary in the first place was because Scala didn't recognize a UnitMatcher as being a reasonable a (FriendlyUnitInfo) => Boolean. If your compiler is confused, presumably it's because they added a feature which allows the type conversion but which ambiguates the overloads :D
Hello Dan! I tried Scala SDK from 2.10 to 2.12, there were same problems. I renamed countOurs and countEnemy, it is OK now. Thank you very much!