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

... should not crash REPL.