diff options
author | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2005-12-16 18:29:42 +0000 |
---|---|---|
committer | Gilles Dubochet <gilles.dubochet@epfl.ch> | 2005-12-16 18:29:42 +0000 |
commit | df50e05006b43b007c2587549030d24b5c154398 (patch) | |
tree | 9edfb1fb5b8c04350a00c163cfcdb1fccd79e3aa /test/files/run/imports.scala | |
parent | 17e2b1c2a6f69ba74e79c30d1e44195fe732e3e3 (diff) | |
download | scala-df50e05006b43b007c2587549030d24b5c154398.tar.gz scala-df50e05006b43b007c2587549030d24b5c154398.tar.bz2 scala-df50e05006b43b007c2587549030d24b5c154398.zip |
'test-nsc' has been moved to 'test'.
Diffstat (limited to 'test/files/run/imports.scala')
-rw-r--r-- | test/files/run/imports.scala | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/test/files/run/imports.scala b/test/files/run/imports.scala new file mode 100644 index 0000000000..d976478d8b --- /dev/null +++ b/test/files/run/imports.scala @@ -0,0 +1,97 @@ +//############################################################################ +// Import statements +//############################################################################ +// $Id$ + +//############################################################################ + +object checker { + def check(where: String, what: String, value: Any): Unit = { + Console.print("In " + where + ", " + what + ".toString() returns "); + Console.flush; + val string: String = if (value == null) "null" else value.toString(); + val test = if (string == where) "ok" else "KO"; + Console.println(string + " -> " + test); + Console.flush; + } +} + +import checker.check; + +//############################################################################ + +//import o_ico.v_ico; + +class C_ico() { + o_ico.v_ico = this; + import o_ico.v_ico; + 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); + Console.println; +} + +object o_ico { + var v_ico: C_ico = null; + new C_ico(); +} + +//############################################################################ + +object o_ioc { + var v_ioc: C_ioc = null; + new C_ioc(); +} + +import o_ioc.v_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); + Console.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); + Console.println; +} + +//############################################################################ + +object Test { + def main(args: Array[String]): Unit = { + o_ico; + o_ioc; + o_oic; + () + } +} + +//############################################################################ |