-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Several type system fixes #4137
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
Conversation
@@ -1967,6 +1967,7 @@ object Types { | |||
def derivedSelect(prefix: Type)(implicit ctx: Context): Type = | |||
if (prefix eq this.prefix) this | |||
else if (prefix.isBottomType) prefix | |||
else if (prefix.isInstanceOf[WildcardType]) WildcardType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's what look like an identical case at the end of this method (case _: WildcardType => WildcardType
), can the two be merged?
Allow several type aliases if they are the same.
One involved selections on WildcardTypes, the other taking the base type of refinement classes. Both manifested themselves in neg/typeclass-encoding2.scala
Sometimes a computation of a superType will give NoType. Keeping with the spirit of unKnownMembers to say yes when in doubt, we should return true in this case. The change is necessary to make the recursive call of `develop` and the call to `flatMap` in `flatten` in typeclass-encoding2.scala typecheck.
tests/pos/typeclass-encoding2.scala
Outdated
type This = Int | ||
type Instance = Monoid | ||
def unit: Int = 0 | ||
def inject($this: Int) = new Monoid { | ||
val common: self.type = self | ||
val common: IntOps.this.type = IntOps.this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be : IntOps.type = IntOps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the same, but less regular. I am after an encoding that works the same for classes and objects. Unfortunately, with self types for objects dropped, we only have qualified this to avoid an irregularity.
Needed to make latest instance of typeclass-encoding2 pass. Compared to previous this one has a single type parameter for `Extension`.
test performance please |
performance test scheduled: 1 job(s) in queue, 0 running. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/4137/ to see the changes. Benchmarks is based on merging with master (990469e) |
- Add straight extensions of type classes, i.e. implementation inherits type class directly. - Rename common as an identifier to commons - Drop `Extension` type.
test performance please |
performance test scheduled: 1 job(s) in queue, 0 running. |
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/4137/ to see the changes. Benchmarks is based on merging with master (990469e) |
Prompted by a study of possible typeclass encodings several small fixes to aspects of type checking.