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

spurious kind errors with higher kinded pattern type variables when type constructor isn't complete #8023

Closed
scabug opened this issue Dec 2, 2013 · 7 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Dec 2, 2013

import language._

object Test {
  (null: Any) match {
    case a: A[k] => new B[k]()
  }
}

class A[K[L[_]]]
class B[K[L[_]]]

This used to work in 2.10.x by virtue of a bug in refchecks (#7756)

Test case minimized from sbt, in util/collection/src/main/scala/sbt/INode.scala

Type variables already pick up the bounds:

import language._

object Test {
  (null: Any) match {
    case a: A[k] => new B[k]()
  }
}

class A[K <: String]
class B[K <: String]
@scabug
Copy link
Author

@scabug scabug commented Dec 2, 2013

@scabug
Copy link
Author

@scabug scabug commented Dec 2, 2013

@retronym said:
Oh man, this one depends on compilation order: this works:

class A[K[L[_]]]
class B[K[L[_]]]

object Test {
  (null: Any) match {
    case a: A[k] => new B[k]()
  }
}

The condition in question:

if (!isComplete)
	args mapConserve (typedHigherKindedType(_, mode))
	// if symbol hasn't been fully loaded, can't check kind-arity
else map2Conserve(args, tparams) { (arg, tparam) =>
	//@M! the polytype denotes the expected kind
	typedHigherKindedType(arg, mode, GenPolyType(tparam.typeParams, AnyTpe))
}

@scabug
Copy link
Author

@scabug scabug commented Dec 2, 2013

@retronym said:
We might be able to make this work in the same place that we enhanceBounds.

@scabug
Copy link
Author

@scabug scabug commented Dec 2, 2013

@retronym said:
Here's what's required to make this work in typedBind (the "bull in the china store" approach of not trying to avoid cycles)

https://github.com/retronym/scala/compare/ticket;8023?expand=1

@scabug
Copy link
Author

@scabug scabug commented Dec 2, 2013

@retronym said:
See: scala/scala@218c5a8 "previous change caused cyclic references.."

@scabug
Copy link
Author

@scabug scabug commented Dec 2, 2013

@adriaanm said:
Always scary to see that "authored 7 years ago", especially when prefixed with your own name.

@scabug
Copy link
Author

@scabug scabug commented Dec 2, 2013

@retronym said:
It might be best to change ones name by deed poll after a decent stretch of time in one codebase.

PR: scala/scala#3212

@scabug scabug closed this Dec 4, 2013
@scabug scabug added the tcpoly label Apr 7, 2017
@scabug scabug added this to the 2.11.0-M8 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants