Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specialize Quantity on numeric value #18

Open
zainab-ali opened this issue Apr 11, 2017 · 1 comment
Open

Specialize Quantity on numeric value #18

zainab-ali opened this issue Apr 11, 2017 · 1 comment

Comments

@zainab-ali
Copy link
Contributor

Specializing the quantity would prevent boxing of base numeric types, which unfortunately happens with AnyVal.

However, specialization doesn't seem to play well with singletons and dependent types.
We get the following bizarre error:

[error] /home/zainab/coding/ithaca/libra/src/main/scala/libra/quantity.scala:36: type mismatch;
[error]  found   : a.Out
[error]  required: a.Out
[error]   def add[D1 <: HList](q1: Quantity[A, D1])(implicit a: Add[Quantity[A, D], Quantity[A, D1]]): a.Out = a(this, q1)

Debug logging on the typer phase gives a lot of:

[warn] !!! HK subtype check on [A]collection.this.SeqLike[A,CC[A]] and scala.this.Singleton, but both don't normalize to polytypes:
[warn]   tp1=[A]collection.this.SeqLike[A,CC[A]] PolyType
[warn]   tp2=scala.this.Singleton ClassNoArgsTypeRef

Is this a scalac bug? Is it a feature? Is it a known issue? Any solutions?

@zainab-ali zainab-ali added this to the 0.3.1 milestone Dec 26, 2017
@zainab-ali
Copy link
Contributor Author

This looks like it's linked to https://github.com/scala/scala-dev/issues/250.

@zainab-ali zainab-ali removed this from the 0.3.1 milestone Feb 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant