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

Definition and use of an object in a function causes compiler crash

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Scala 2.10.0
    • Component/s: Misc Compiler
    • Labels:
      None

      Description

      The following (illegal) code causes a compiler crash in 2.7.1 final

      {() => case class Bar; Bar}

        Activity

        Hide
        James Iry added a comment -

        The simpler "

        {case class Bar; Bar}

        " causes a type mismatch error, but does not crash.

        Show
        James Iry added a comment - The simpler " {case class Bar; Bar} " causes a type mismatch error, but does not crash.
        Hide
        James Iry added a comment -

        The simpler "

        {() => object Bar; Bar}

        " also crashes.

        Show
        James Iry added a comment - The simpler " {() => object Bar; Bar} " also crashes.
        Hide
        Aaron Harnly added a comment -

        Yeah, I'm not certain whether this is invalid / illegal. The related code

        { object Bar ; Bar }
        

        which gives a type error:

         found   : Bar.type(in object $$iw) where type Bar.type(in object $$iw) <: Bar with Singleton
         required: Bar.type(in value res1) forSome { type Bar.type(in value res1) <: Bar with Singleton; type Bar <: java.lang.Object with ScalaObject }
        

        should maybe return a value of type ScalaObject?

        Show
        Aaron Harnly added a comment - Yeah, I'm not certain whether this is invalid / illegal. The related code { object Bar ; Bar } which gives a type error: found : Bar.type(in object $$iw) where type Bar.type(in object $$iw) <: Bar with Singleton required: Bar.type(in value res1) forSome { type Bar.type(in value res1) <: Bar with Singleton; type Bar <: java.lang.Object with ScalaObject } should maybe return a value of type ScalaObject?
        Hide
        Aaron Harnly added a comment -

        or ScalaObject with Singleton.

        Show
        Aaron Harnly added a comment - or ScalaObject with Singleton.
        Hide
        James Iry added a comment -

        Based on aaronharnly's comment, I'm renaming this bug and I've created SI-1201 as a separate issue

        Show
        James Iry added a comment - Based on aaronharnly's comment, I'm renaming this bug and I've created SI-1201 as a separate issue
        Hide
        Paul Phillips added a comment -

        Fixed in 7a6fa80937 or 7a6fa80937^ .

        Show
        Paul Phillips added a comment - Fixed in 7a6fa80937 or 7a6fa80937^ .

          People

          • Assignee:
            Paul Phillips
            Reporter:
            James Iry
            TracCC:
            Seth Tisue
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development