[SPARK-3200][REPL] Classes defined with reference to external variables,...

... should not crash REPL.

This might not be a critical bug fix. But this patch will make things more predictable. 

In this patch, I have introduced another condition. Where if a class refers to an external variable then we just fallback to our old style of importing.

For example,  
When class does not refers any outside variable.

```scala

scala> case class A()
case class A()
defined class A

scala> A() // show
A() // show
class $read extends Serializable {
  def <init>() = {
    super.<init>;
    ()
  };
  class $iwC extends Serializable {
    def <init>() = {
      super.<init>;
      ()
    };
    class $iwC extends Serializable {
      def <init>() = {
        super.<init>;
        ()
      };
      class $iwC extends Serializable {
        def <init>() = {
          super.<init>;
          ()
        };
        import org.apache.spark.SparkContext._;
        import $line11.$read.INSTANCE.$iw.$iw.A;
        class $iwC extends Serializable {
          def <init>() = {
            super.<init>;
            ()
          };
          val res1 = A
        };
        val $iw = new $iwC.<init>
      };
      val $iw = new $iwC.<init>
    };
    val $iw = new $iwC.<init>
  };
  val $iw = new $iwC.<init>
}
object $read extends scala.AnyRef {
  def <init>() = {
    super.<init>;
    ()
  };
  val INSTANCE = new $read.<init>
}
res1: A = A()

```

And when it does refer outside variable.

```scala
scala> val c = 10
val c = 10
c: Int = 10

scala> case class A() { val q = c }
case class A() { val q = c }
defined class A

scala> A() // show
A() // show
class $read extends Serializable {
  def <init>() = {
    super.<init>;
    ()
  };
  class $iwC extends Serializable {
    def <init>() = {
      super.<init>;
      ()
    };
    class $iwC extends Serializable {
      def <init>() = {
        super.<init>;
        ()
      };
      class $iwC extends Serializable {
        def <init>() = {
          super.<init>;
          ()
        };
        import org.apache.spark.SparkContext._;
        val $VAL2 = $line13.$read.INSTANCE;
        import $VAL2.$iw.$iw.$iw.$iw.c;
        val $VAL4 = $line14.$read.INSTANCE;
        import $VAL4.$iw.$iw.A;
        class $iwC extends Serializable {
          def <init>() = {
            super.<init>;
            ()
          };
          val res2 = A
        };
        val $iw = new $iwC.<init>
      };
      val $iw = new $iwC.<init>
    };
    val $iw = new $iwC.<init>
  };
  val $iw = new $iwC.<init>
}
object $read extends scala.AnyRef {
  def <init>() = {
    super.<init>;
    ()
  };
  val INSTANCE = new $read.<init>
}
res2: A = A()

```

Note the difference in how `A` is imported in both cases. 
[EDIT]
With this patch few other non-regression/never reported and non critical bug like if you import [exp.scala](https://gist.github.com/ScrapCodes/d6dc6efd7b0e24e638b3) twice will break things is also solved. 

However I have consciously chosen to "retain" a bug that two instances of classes that refer external variables will not type check.  
Note for self: This should be local-cluster.