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

weak subtyping does not handle types properly #7228

Closed
scabug opened this issue Mar 7, 2013 · 3 comments
Closed

weak subtyping does not handle types properly #7228

scabug opened this issue Mar 7, 2013 · 3 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

scabug commented Mar 7, 2013

More of the usual with dealiasing, widening, etc, the problem neatly summarized here:

scala> isWeakSubType(typeOf[Int], typeOf[Double])
res0: Boolean = true

scala> isWeakSubType(typeOf[Int].narrow, typeOf[Double])
res1: Boolean = false

I already fixed it, opening to have a reference. Test case:

object AdaptWithWeaklyConformantType {
  implicit class D(d: Double) { def double = d*2 }

  val x1: Int = 1
  var x2: Int = 2
  val x3 = 3
  var x4 = 4
  final val x5 = 5
  final var x6 = 6

  def f1 = x1.double
  def f2 = x2.double
  def f3 = x3.double
  def f4 = x4.double
  def f5 = x5.double
  def f6 = x6.double
}
@scabug
Copy link
Author

scabug commented Mar 7, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7228?orig=1
Reporter: @paulp

@scabug
Copy link
Author

scabug commented Mar 8, 2013

@paulp said:
paulp/scala@ba159c1

@scabug
Copy link
Author

scabug commented Nov 21, 2013

@retronym said:
Closing as I don't see residuals other than the commit message "probably not the ideal fix"

@scabug scabug closed this as completed Nov 21, 2013
@scabug scabug added the has PR label Apr 7, 2017
@scabug scabug added this to the 2.11.0-M2 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants