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

Compiler crash in GenICode after using implicit def XX to add overloaded * to enriched Int.

    Details

      Description

      After trying to compile the code below the compiler crashed with the exception in GenICode$$ICodePhase.genLoadArguments. Tried both on 2.7.3final and 2.8.0.r17382 - same results. See the call stack below.

      // Edit by paulp: reduced.
      trait Cloning {
        trait Foo
        def fn(g: Any => Unit): Foo
        
        implicit def mkStar(i: Int) = new { def *(a: Foo): Foo = null }
      
        val pool = 4 * fn { case iii: Int => iii * 2 }
      }
      

      {{

      1. scalac Swarm.scala
        Exception in thread "main" java.lang.Error: symbol value iii$$1 does not exist in playground.Swarm.main
        at scala.tools.nsc.backend.icode.GenICode$$ICodePhase.scala$$tools$$nsc$$backend$$icode$$GenICode$$ICodePhase$$$$genLoad(GenICode.scala:912)
        at scala.tools.nsc.backend.icode.GenICode$$ICodePhase.genLoadArguments(GenICode.scala:1103)

        Activity

        Hide
        Paul Phillips added a comment -

        I think this is related to SI-1110, a bug which looked easy to fix but when I tried a while back I did not succeed. Notice that if you use a name like "foo" instead of "*" it compiles okay.

        Show
        Paul Phillips added a comment - I think this is related to SI-1110 , a bug which looked easy to fix but when I tried a while back I did not succeed. Notice that if you use a name like "foo" instead of "*" it compiles okay.
        Hide
        Szymon Jachim added a comment -

        Also if i move the actor

        { ... }

        call to a separate val proto definition and than just do 4 * proto it also works :-|

          val proto = actor {   ...   }
          val pool = 4 * proto
        

        Might me a useful hint.

        Show
        Szymon Jachim added a comment - Also if i move the actor { ... } call to a separate val proto definition and than just do 4 * proto it also works :-| val proto = actor { ... } val pool = 4 * proto Might me a useful hint.
        Hide
        Gilles Dubochet added a comment -

        I don't know what that bug is. Could it have been assigned to me by mistake?

        Show
        Gilles Dubochet added a comment - I don't know what that bug is. Could it have been assigned to me by mistake?
        Hide
        Paul Phillips added a comment -

        I think it was assigned to you because I speculated above that it is related to SI-1110, and that because this bug also is triggered only when one uses a method name which is shared by the name of a primitive operation.

        On closer inspection I don't think they're related except inasmuch as the platonically ideal fix to both bugs would likely involve some shared machinery for dealing with the issue.

        Show
        Paul Phillips added a comment - I think it was assigned to you because I speculated above that it is related to SI-1110 , and that because this bug also is triggered only when one uses a method name which is shared by the name of a primitive operation. On closer inspection I don't think they're related except inasmuch as the platonically ideal fix to both bugs would likely involve some shared machinery for dealing with the issue.
        Hide
        Iulian Dragos added a comment -

        It's a bug in the pattern matcher, there's no definition of `iii` after pattern expansion.

        Show
        Iulian Dragos added a comment - It's a bug in the pattern matcher, there's no definition of `iii` after pattern expansion.
        Hide
        Adriaan Moors added a comment -

        nope, it's a bug in the type checker, in typedBind, more precisely --> https://github.com/scala/scala/pull/958

        Show
        Adriaan Moors added a comment - nope, it's a bug in the type checker, in typedBind, more precisely --> https://github.com/scala/scala/pull/958
        Hide
        Paul Phillips added a comment -

        Wow, you got this one? You are on an epic tear.

        Show
        Paul Phillips added a comment - Wow, you got this one? You are on an epic tear.
        Hide
        Adriaan Moors added a comment - - edited

        Og inspired me. Just mutate.

        Show
        Adriaan Moors added a comment - - edited Og inspired me. Just mutate.

          People

          • Assignee:
            Adriaan Moors
            Reporter:
            Szymon Jachim
            TracCC:
            Paul Phillips
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development