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

2.13 Regression. Possibly related to stabilization issues #11397

Open
soronpo opened this Issue Feb 10, 2019 · 3 comments

Comments

Projects
None yet
3 participants
@soronpo
Copy link

soronpo commented Feb 10, 2019

Possibly related to #10714 which was fixed in scala/scala#6312

The following code demonstrates an error in code execution order.
An assertion placed show exactly where the error occurs.

trait MyAny {
  type TSomething
  type This <: MyAny
}

class MyBool extends MyAny {
  type TSomething = DummyImplicit
  type This = MyBool
}

object Test extends App {
  val i = new MyBool
  var call = 0

  final class MyMatch[MV <: MyAny](val matchVal : MV)  {
    def myCase[MC](pattern : Boolean)(block : => Unit)(
      implicit patternBld : matchVal.TSomething
    ) : MyMatch[MV] = {
      call -= 1
      block
      this
    }
  }

  def myMatch[MV <: MyAny](matchValue : MV) : MyMatch[matchValue.This] = {
    assert(call == 0)
    call += 1
    new MyMatch[matchValue.This](matchValue.asInstanceOf[matchValue.This])
  }

  myMatch(i)
    .myCase(true) {
      myMatch(i)
        .myCase(true) {

        }
    }
}

Affected Scalac version: from 2.13.0-M4
2.13.0-M2 is OK. 2.13.0-M3 causes a crash as demonstrated in #10714
The reason I'm thinking it's related to the stabilization bug is that if we change the code to the following, there is no error:

  myMatch(i)
    .myCase(true) {
      val noErrorNow = myMatch(i)
        .myCase(true) {

        }
    }
@adriaanm

This comment has been minimized.

Copy link
Member

adriaanm commented Feb 10, 2019

@milessabin could you investigate whether we need to fix this in RC1?

@milessabin

This comment has been minimized.

Copy link

milessabin commented Feb 11, 2019

I'll take a look.

@milessabin

This comment has been minimized.

Copy link

milessabin commented Feb 13, 2019

@adriaanm I'm afraid I'm not going to have time to dig in to this for a week or two.

@adriaanm adriaanm modified the milestones: 2.13.0-RC1, 2.13.1 Feb 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment