-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #2220: Change handling of package objects and tweak hk type inference #2205
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -726,10 +726,9 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling { | |
|
||
tycon2 match { | ||
case param2: TypeParamRef => | ||
isMatchingApply(tp1) || { | ||
if (canConstrain(param2)) canInstantiate(param2) | ||
else compareLower(bounds(param2), tyconIsTypeRef = false) | ||
} | ||
isMatchingApply(tp1) || | ||
canConstrain(param2) && canInstantiate(param2) || | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just merged #2204. I don't have a separate test case for this change, but would argue that the fact that we missed the case before means we cannot exclude that we will miss it in the future. So better play it safe. |
||
compareLower(bounds(param2), tyconIsTypeRef = false) | ||
case tycon2: TypeRef => | ||
isMatchingApply(tp1) || | ||
compareLower(tycon2.info.bounds, tyconIsTypeRef = true) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package bar | ||
import scala.language.higherKinds | ||
class Fix[F[_]](unfix: F[Fix[F]]) | ||
object DocTree { | ||
def docTree(s: StreamTree[DocTree]): DocTree = new Fix(s: StreamTree[DocTree]) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package object bar { | ||
type StreamTree[T] = Stream[Int] | ||
type DocTree = Fix[StreamTree] | ||
} |
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.
Would it possible to detect when a scala package object member hides a scala class/object and return an error?
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.
Not sure. It would be tricky since everything we do in the scala package is fraught with causing all sorts of initialization errors. Not sure it's worth it really, given that we never had a problem so far.