Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Singleton types not inferred in all places they should be even after r25861 #5103

Closed
scabug opened this issue Oct 21, 2011 · 12 comments
Closed

Comments

@scabug
Copy link

scabug commented Oct 21, 2011

With Scala trunk, following r25861 and with -Yexperimental specified.

In the REPL transcript below, the compiler infers T as the non-singleton type String, and then rejects it as not conforming to the explicitly provided bound <: Singleton.

miles@lewis:scala$ scala-trunk -Xexperimental
Welcome to Scala version 2.10.0.r25866-b20111021020217 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0).
Type in expressions to have them evaluated.
Type :help for more information.

scala> val x = "one"
x: String = one

scala> def single[T <: Singleton](x : T) = x
single: [T <: Singleton](x: T)T

scala> single(x)
<console>:10: error: inferred type arguments [String] do not conform to method single's type parameter bounds [T <: Singleton]
              single(x)
              ^

scala> single[x.type](x)
res2: x.type = one
@scabug
Copy link
Author

scabug commented Oct 21, 2011

Imported From: https://issues.scala-lang.org/browse/SI-5103?orig=1
Reporter: @milessabin

@scabug
Copy link
Author

scabug commented Jul 10, 2013

@adriaanm said:
Unassigning and rescheduling to M6 as previous deadline was missed.

@scabug
Copy link
Author

scabug commented May 12, 2014

@retronym said:
I had a quick stab at implementing this. I can get these tests to pass, but couldn't stop other tests from failing.

https://github.com/retronym/scala/compare/ticket/5103

/cc [~folone]

@scabug
Copy link
Author

scabug commented May 13, 2014

@milessabin said:
I've given this a quick spin and it covers a lot of my cases ... I would very likely be able to remove the singleton type related macros from shapeless with this fix :-)

@scabug
Copy link
Author

scabug commented Jul 12, 2014

@milessabin said:
Where are we with this getting merged? Any chance of having it in 2.11.2?

@scabug
Copy link
Author

scabug commented Jul 13, 2014

@retronym said:
It's not ready for the primetime, unfortunately.

I got stuck and couldn't figure out how to take the step forward without breaking existing code.

From the commit comment:

Checking in again with `pos` reveals breakage around typetags and
manifests, among others.

test/partest --update-check
/Users/jason/code/scala/test/files/pos/annotated-treecopy
/Users/jason/code/scala/test/files/pos/macro-implicit-invalidate-on-error.scala
/Users/jason/code/scala/test/files/pos/manifest1-new.scala
/Users/jason/code/scala/test/files/pos/nothing_manifest_disambig-new.scala
/Users/jason/code/scala/test/files/pos/nothing_manifest_disambig-old.scala
/Users/jason/code/scala/test/files/pos/t4501.scala
/Users/jason/code/scala/test/files/pos/t5022.scala
/Users/jason/code/scala/test/files/pos/t7190.scala
/Users/jason/code/scala/test/files/pos/t7516
/Users/jason/code/scala/test/files/pos/t7649.scala
/Users/jason/code/scala/test/files/pos/t7818.scala

```

@scabug
Copy link
Author

scabug commented Jul 13, 2014

@milessabin said:
What sort of breakage are you seeing? I vaguely remember that there was quite a bit of unnecessary T <: Singleton sprinkled over tags and manifests when plain old dependent method types would do ... are these the things falling foul of the fix?

@scabug
Copy link
Author

scabug commented Aug 11, 2016

@SethTisue said:
@milessabin does your SIP-23 work affect this?

@scabug
Copy link
Author

scabug commented Aug 11, 2016

@milessabin said:
Yes, this is fixed on that branch. Initial work by Adriaan with some tweaks subsequently by me.

@scabug
Copy link
Author

scabug commented Aug 11, 2016

@SethTisue said:
haha I'd better not forget that with Adriaan sitting next right to me! :-)

scala/scala#5310

@scabug
Copy link
Author

scabug commented Oct 29, 2016

@milessabin said:
Why has this been put back to 2.12.2?

@scabug
Copy link
Author

scabug commented Oct 29, 2016

@adriaanm said:
I was making a sweep through tickets assigned to 2.12.1 to get them down to a reasonable number given the deadline of Nov 30.

@scabug scabug added this to the 2.12.3 milestone Apr 7, 2017
@retronym retronym modified the milestones: 2.12.3, 2.12.4 Jul 8, 2017
@adriaanm adriaanm modified the milestones: 2.12.4, 2.12.5 Oct 10, 2017
@lrytz lrytz modified the milestones: 2.12.5, 2.13.0-M4 Mar 1, 2018
@lrytz lrytz closed this as completed Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants