typelevel/squants

Inconsistent SVector operator overloads

Closed this issue · 1 comments

There are a few problems with the operator overloads on the SVector types. First the operators on the base SVector are mostly defined as functions, not methods, which is confusing and inconsistent. The * operator is also redefined on QuantityVector, but as a method, so it does not properly override it (this overload seems to be redundant). This makes Intellij complain that it can't resolve "*" in code like

SVector(Meters(1), Meters(2)) * 3

due to the ambiguous lookup, although strangely, it compiles fine...

There are also missing overloads of the * and #* operators corresponding to times, dotProduct and crossProduct going from DoubleVector to Quantity/QuantityVector.

That's likely a bug in Intellij and not Squants. The SVector code has all the appropriate overrides and like you said, it compiles. Its probably Intellij's internal scala compiler not being able to handle some of the type inference magic that Squant's uses. I don't think anyone wants those to go auto-magical conversions to go away.

Its likely an annoyance that you will have to put up with when using Scala in general in Intellij. Its really hard to do code coloring on Scala and function resolution on code being edited is even harder.