From 8704ed2fc92e3d82287317fe34126c5d4d84e10c Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Thu, 20 Oct 2011 22:28:58 +0000 Subject: infer singleton when asking for it a type var's constraint now also tracks whether the type var was compared to a stable type if it was, we probably shouldn't widen the type argument that's inferred for this var, as the result will surely fail to type check NOTE: must be enabled using -Xexperimental review by extempore --- test/files/pos/infersingle.flags | 1 + test/files/pos/infersingle.scala | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 test/files/pos/infersingle.flags create mode 100644 test/files/pos/infersingle.scala (limited to 'test') diff --git a/test/files/pos/infersingle.flags b/test/files/pos/infersingle.flags new file mode 100644 index 0000000000..e1b37447c9 --- /dev/null +++ b/test/files/pos/infersingle.flags @@ -0,0 +1 @@ +-Xexperimental \ No newline at end of file diff --git a/test/files/pos/infersingle.scala b/test/files/pos/infersingle.scala new file mode 100644 index 0000000000..6830fcd799 --- /dev/null +++ b/test/files/pos/infersingle.scala @@ -0,0 +1,5 @@ +object Test { + def one[T](x: T): Option[T] = Some(x) + val x = "one" + val y: Option[x.type] = one(x) +} \ No newline at end of file -- cgit v1.2.3