Problems with "muddy" (ie not properly transparent) type aliases.. #412
Replies: 2 comments 1 reply
-
I frequently find it hard to distinguish between real problems and red herrings, but I do know that I see you working a lot with Or, you could try implementing your own I still suspect that Scala has a few rough edges around |
Beta Was this translation helpful? Give feedback.
-
My gut feel is that there's definitely problem(s) where Scala 3 can fail to recognise that aliases of a type are the same thing. Things I want to investigate are:
One thing I was going to try was to strip out absolutely every export, and see if the problem resolves. My own, but also coulomb's |
Beta Was this translation helpful? Give feedback.
-
Apologies in advance, this is a only semi-digested problem report that troubles and intrigues me.
I have a
basetype
package which exports coulomb to my application, and also declares some common aliases:But the use site for
asMillis
:Wont compile. The whole error msg is:
What I find troubling is:
What is this type
(offset : basetypes.Seconds) & coulomb.Quantity[Long, $proxy4.Second]
? Since Seconds is defined asSeconds = Quantity[Long, Second]
, this type looks like an intersection with itself!? Why cant the compiler unify it?/The types Second and Second² are the same, one is just an alias for the other. why is the compiler talking as if they're different?
It seems like the compiler can't see through some type aliases, either the Second alias in basetypes, or else the export aliases created by export clauses..
Beta Was this translation helpful? Give feedback.
All reactions