diff options
Diffstat (limited to 'test/files/run/imports.scala')
-rw-r--r-- | test/files/run/imports.scala | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/test/files/run/imports.scala b/test/files/run/imports.scala new file mode 100644 index 0000000000..0eb342b984 --- /dev/null +++ b/test/files/run/imports.scala @@ -0,0 +1,95 @@ +//############################################################################ +// Import statements +//############################################################################ +// $Id$ + +//############################################################################ + +object checker { + def check(where: String, what: String, value: Any): Unit = { + System.out.print("In " + where + ", " + what + ".toString() returns "); + System.out.flush(); + val string: String = if (value == null) "null" else value.toString(); + val test = if (string == where) "ok" else "KO"; + System.out.println(string + " -> " + test); + System.out.flush(); + } +} + +import checker.check; + +//############################################################################ + +import o_ico.v_ico; + +class C_ico() { + o_ico.v_ico = this; + override def toString(): String = "C_ico"; + def method: C_ico = v_ico; + val field: C_ico = v_ico; + + check("C_ico", "v_ico ", v_ico); + check("C_ico", "field ", field); + check("C_ico", "method", method); + System.out.println(); +} + +object o_ico { + var v_ico: C_ico = null; + new C_ico(); +} + +//############################################################################ + +import o_ioc.v_ioc; + +object o_ioc { + var v_ioc: C_ioc = null; + new C_ioc(); +} + +class C_ioc() { + o_ioc.v_ioc = this; + override def toString(): String = "C_ioc"; + def method: C_ioc = v_ioc; + val field: C_ioc = v_ioc; + + check("C_ioc", "v_ioc ", v_ioc); + check("C_ioc", "field ", field); + check("C_ioc", "method", method); + System.out.println(); +} + +//############################################################################ + +object o_oic { + var v_oic: C_oic = null; + new C_oic(); +} + +import o_oic.v_oic; + +class C_oic() { + o_oic.v_oic = this; + override def toString(): String = "C_oic"; + def method: C_oic = v_oic; + val field: C_oic = v_oic; + + check("C_oic", "v_oic ", v_oic); + check("C_oic", "field ", field); + check("C_oic", "method", method); + System.out.println(); +} + +//############################################################################ + +object Test { + def main(args: Array[String]): Unit = { + o_ico; + o_ioc; + o_oic; + () + } +} + +//############################################################################ |