Scala Programming Language
  1. Scala Programming Language
  2. SI-5559

don't crash with "Error: trying to do lub/glb of typevar ?T"

    Details

      Description

      scalac crashes with the message below.

      to reproduce: [snipped laborious cloning exercise, see comments for self-contained reproductions.]

        Issue Links

          Activity

          Hide
          Espen Wiborg added a comment -

          This also bites me when using the Hamcrest matchers included with JUnit 4.11. I can probably find a minimal example if necessary.

          Show
          Espen Wiborg added a comment - This also bites me when using the Hamcrest matchers included with JUnit 4.11. I can probably find a minimal example if necessary.
          Hide
          Paul Phillips added a comment -

          It might be interesting to have a java version of the bug. It's too big for one language.

          Show
          Paul Phillips added a comment - It might be interesting to have a java version of the bug. It's too big for one language.
          Hide
          James Iry added a comment -

          https://github.com/JamesIry/scala/commit/975a19c4018cd6a8ec0129ac3b9f4c08d5217382 doesn't get to the heart of the problem of why type vars are getting where we don't expect them but it does turn the crash into error messages https://gist.github.com/JamesIry/4735290. But Adriaan is concerned that there will be cases that don't get an error message and just silently flow through to nonsense.

          Show
          James Iry added a comment - https://github.com/JamesIry/scala/commit/975a19c4018cd6a8ec0129ac3b9f4c08d5217382 doesn't get to the heart of the problem of why type vars are getting where we don't expect them but it does turn the crash into error messages https://gist.github.com/JamesIry/4735290 . But Adriaan is concerned that there will be cases that don't get an error message and just silently flow through to nonsense.
          Hide
          Iulian Dragos added a comment -

          The hamcrest minimized version:

          import org.hamcrest.CoreMatchers._
          import org.junit.Assert._
          
          class MyTest {
          
            var state = 10
          
            def test() {
              assertThat("Bad state before runToBreakpoint", state, anyOf(is(42), is(-42)))
            }
          }
          

          Use the following for build.sbt

          name := "test-crash"
          
          scalaVersion := "2.10.2-SNAPSHOT"
          
          resolvers += Resolver.sonatypeRepo("snapshots")
          
          libraryDependencies += "junit" % "junit" % "4.11"
          

          It fails with virtually all Scala versions known to man [2.9.3 - 2.11.0-M3]

          Show
          Iulian Dragos added a comment - The hamcrest minimized version: import org.hamcrest.CoreMatchers._ import org.junit.Assert._ class MyTest { var state = 10 def test() { assertThat("Bad state before runToBreakpoint", state, anyOf(is(42), is(-42))) } } Use the following for build.sbt name := "test-crash" scalaVersion := "2.10.2-SNAPSHOT" resolvers += Resolver.sonatypeRepo("snapshots") libraryDependencies += "junit" % "junit" % "4.11" It fails with virtually all Scala versions known to man [2.9.3 - 2.11.0-M3]
          Hide
          James Iry added a comment -

          2.10.3-RC1 is coming at the end of the week. If there isn't going to be a PR in the next couple of days then let's kick this to 2.10.4-RC1.

          Show
          James Iry added a comment - 2.10.3-RC1 is coming at the end of the week. If there isn't going to be a PR in the next couple of days then let's kick this to 2.10.4-RC1.

            People

            • Assignee:
              Adriaan Moors
              Reporter:
              Nikolay Botev
            • Votes:
              1 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:

                Development