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

type mismatch in ValDef with inferred existential type #4171

Closed
scabug opened this issue Jan 19, 2011 · 10 comments
Closed

type mismatch in ValDef with inferred existential type #4171

scabug opened this issue Jan 19, 2011 · 10 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Jan 19, 2011

scala> val c = { class C; new C { def foo = 1 } }
<console>:5: error: type mismatch;
 found   : $$anon(in value c) where type $$anon(in value c) <: C{def foo: Int}
 required: $$anon(in value c) forSome { type $$anon(in value c) <: C{def foo: Int}; type C <: java.lang.Object with ScalaObject }
       val c = { class C; new C { def foo = 1 } }
           ^

or without an anonymous class:

scala> val a = { class B; class C extends B; new C }
<console>:6: error: type mismatch;
 found   : C(in value a) where type C(in value a) <: B with ScalaObject
 required: C(in value a) forSome { type C(in value a) <: B with ScalaObject; type B <: java.lang.Object with ScalaObject }
       val a = { class B; class C extends B; new C }
           ^
@scabug
Copy link
Author

scabug commented Jan 19, 2011

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

@scabug
Copy link
Author

scabug commented Jan 19, 2011

@paulp said:
Closely related to #1201.

@scabug
Copy link
Author

scabug commented Jan 26, 2011

@adriaanm said:
see also: #4110

@scabug
Copy link
Author

scabug commented Jan 26, 2011

@adriaanm said:
see also: #3960

@scabug
Copy link
Author

scabug commented Jul 7, 2011

@SethTisue said:
#1195, too

@scabug
Copy link
Author

scabug commented Jul 7, 2011

@SethTisue said:
this slight variant also triggers the error. could be part of the test coverage if a fix is found:

scala> { class A; class B extends A; classOf[B] }
<console>:7: error: type mismatch;
 found   : java.lang.Class[B(in value res4)] where type B(in value res4) <: A with ScalaObject
 required: java.lang.Class[_ <: A with ScalaObject]
       val res4 =
           ^

@scabug
Copy link
Author

scabug commented Jul 9, 2011

@paulp said:

scala> val c = { class C; new C { def foo = 1 } }
c: ScalaObject{def foo: Int} = $anon$1@7b26c885

scala> c.foo
res0: Int = 1

@scabug
Copy link
Author

scabug commented Jul 21, 2011

@SethTisue said:
Paul: is your comment meant to imply this is now fixed? I'm not seeing that it is fixed on trunk, as of r25323.

@scabug
Copy link
Author

scabug commented Jul 21, 2011

@paulp said:
Sorry, that was needlessly opaque. It was meant to show that I have fixed it in principle, but I'd have closed it if I was saying it's fixed. That code is not yet checked in.

@scabug
Copy link
Author

scabug commented Feb 11, 2012

@soc said:
Closed in scala/scala@c478eb7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants