Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-5850

Inlined code shouldn't forget null-check on the original receiver

    Details

      Description

      Running the program below should result in NPE, however under -optimize the println statement is executed.

      object Test {
        def main(args: Array[String]): Unit = {
          val r: C = null;
          r.callee()
        }
      }
       
      final class C {
        @inline final def callee() { println("callee's body has run.") }
      }
      

      Vlad Ureche, watch out for a similar situation when rewriting tail calls.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                magarcia Miguel Garcia
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: