From 41bfef808702c291d69d5f742628e1304632bdda Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Tue, 10 Aug 2010 21:12:13 +0000 Subject: different approach to manifests of type par... different approach to manifests of type parameters: before, ambiguity was prevented by leaving type inference failures (Nothing was inferred) in the expression that needs an implicit manifest -- we now put these back in undetparams (maybe they will be inferred) and when we need to produce a manifest for an undetermined parameter (it ended up not being inferred), we assume it will get instantiated to Nothing (but for now don't actually reflect that in the SearchResult, as instantiate should take care of that anyway) see test file for use case that works with this new scheme, but did not work before: the eager instantiation of type params to Nothing before implicit search even got started would indeed prevent ambiguity -- unfortunately it also ruled out valid code like this (where the type parameter is inferred successfully by the time the manifest is needed) review by odersky --- test/files/pos/nothing_manifest_disambig.scala | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 test/files/pos/nothing_manifest_disambig.scala (limited to 'test') diff --git a/test/files/pos/nothing_manifest_disambig.scala b/test/files/pos/nothing_manifest_disambig.scala new file mode 100644 index 0000000000..9a3db0c6d4 --- /dev/null +++ b/test/files/pos/nothing_manifest_disambig.scala @@ -0,0 +1,10 @@ +object Test { + def mani[T: Manifest](xs: T) = xs + mani(List()) + + def listElMani[T: Manifest](xs: List[T]) = xs + listElMani(List()) + + def foo[A, C](m : C)(implicit ev: C <:< Traversable[A], mani: Manifest[A]): (C, A, Manifest[A]) = (m, m.head, mani) + foo(List(1,2,3)) +} \ No newline at end of file -- cgit v1.2.3