diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2010-08-10 21:12:13 +0000 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2010-08-10 21:12:13 +0000 |
commit | 41bfef808702c291d69d5f742628e1304632bdda (patch) | |
tree | 264d080aca6a0e0059d845cb44716d0cab2afba3 /test | |
parent | 04c38829b6fdb03ab62ee20ebff6a56c519bb358 (diff) | |
download | scala-41bfef808702c291d69d5f742628e1304632bdda.tar.gz scala-41bfef808702c291d69d5f742628e1304632bdda.tar.bz2 scala-41bfef808702c291d69d5f742628e1304632bdda.zip |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/files/pos/nothing_manifest_disambig.scala | 10 |
1 files changed, 10 insertions, 0 deletions
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 |