Skip to content

Fix #4031: Check arguments of dependent methods for realizability #4036

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

Closed
wants to merge 15 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "Replace isLambdaSub with hasSimpleKind"
This reverts commit 283f261 because it
introduces failures (which I don't get yet), as also shown in
http://dotty-ci.epfl.ch/lampepfl/dotty/5085/4.
  • Loading branch information
Blaisorblade committed Aug 16, 2018
commit 23e6bebf896f3febd2f75d256519c029a2830b5e
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
if (cls2.typeParams.isEmpty) {
if (cls2 eq AnyKindClass) return true
if (tp1.isRef(NothingClass)) return true
if (!tp1.hasSimpleKind) return false
if (tp1.isLambdaSub) return false
if (cls2 eq AnyClass) return true
Copy link
Contributor

@Blaisorblade Blaisorblade May 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actual behavior change. But AnyKindClass was tested first, gotta check if this is still needed.

EDIT: This is still needed, otherwise we get

-- [E007] Type Mismatch Error: /Users/pgiarrusso/git/dotty/tests/pos/i4031.scala:7:35 ----------------------------------
7 |  def coerce3(x: Any): Any = upcast(p, x)  // ok, since dependent result type is not needed
  |                             ^^^^^^^^^^^^
  |                             found:    Any#L
  |                             required: Any

// Note: We would like to replace this by `if (tp1.hasHigherKind)`
// but right now we cannot since some parts of the standard library rely on the
Expand Down