This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Nested object regression

6 replies
Jason Zaugg
Joined: 2009-05-18,
User offline. Last seen 38 weeks 5 days ago.

Sorry I didn't find this sooner, but this one is a silent killer:

https://lampsvn.epfl.ch/trac/scala/ticket/4565

scala> def foo = { object A; def a(x: Any) = x == A; a(A)}
foo: Boolean

scala> foo
res9: Boolean = true

scala> trait T { def foo = { object A; def a(x: Any) = x == A; a(A)} };
defined trait T

scala> new T{}.foo
res10: Boolean = false

-jason

odersky
Joined: 2008-07-29,
User offline. Last seen 45 weeks 6 days ago.
Re: Nested object regression


On Wed, May 11, 2011 at 7:43 AM, Jason Zaugg <jzaugg [at] gmail [dot] com> wrote:
Sorry I didn't find this sooner, but this one is a silent killer:

https://lampsvn.epfl.ch/trac/scala/ticket/4565


Ouch. Thanks for uncovering this. We will work on a fix immediately.

 -- Martin

Hubert Plociniczak
Joined: 2009-09-12,
User offline. Last seen 42 years 45 weeks ago.
Re: Nested object regression

On 05/11/2011 07:43 AM, Jason Zaugg wrote:
> Sorry I didn't find this sooner, but this one is a silent killer:
>
> https://lampsvn.epfl.ch/trac/scala/ticket/4565
>
> scala> def foo = { object A; def a(x: Any) = x == A; a(A)}
> foo: Boolean
>
> scala> foo
> res9: Boolean = true
>
> scala> trait T { def foo = { object A; def a(x: Any) = x == A; a(A)} };
> defined trait T
>
> scala> new T{}.foo
> res10: Boolean = false
>
> -jason

Fixed. Thanks for reporting it.

hubert

Viktor Klang
Joined: 2008-12-17,
User offline. Last seen 1 year 27 weeks ago.
Re: Nested object regression


On Wed, May 11, 2011 at 2:40 PM, Hubert Plociniczak <hubert [dot] plociniczak [at] epfl [dot] ch> wrote:
On 05/11/2011 07:43 AM, Jason Zaugg wrote:
Sorry I didn't find this sooner, but this one is a silent killer:

https://lampsvn.epfl.ch/trac/scala/ticket/4565

  scala>  def foo = { object A; def a(x: Any) = x == A; a(A)}
  foo: Boolean

  scala>  foo
  res9: Boolean = true

  scala>  trait T { def foo = { object A; def a(x: Any) = x == A; a(A)} };
  defined trait T

  scala>  new T{}.foo
  res10: Boolean = false

-jason


Fixed. Thanks for reporting it.

Woot! Yay for Hubert!
 

hubert



--
Viktor Klang,
Director of Research and Development
Scalable Solutions

Code:   github.com/viktorklang
Follow: twitter.com/viktorklang
Read:   klangism.tumblr.com

Jason Zaugg
Joined: 2009-05-18,
User offline. Last seen 38 weeks 5 days ago.
Re: Nested object regression

2011/5/11 √iktor Ҡlang :
>
>
> On Wed, May 11, 2011 at 2:40 PM, Hubert Plociniczak
> wrote:
>> Fixed. Thanks for reporting it.
>
> Woot! Yay for Hubert!

And Iulian, by the looks, for the epic test case.

http://lampsvn.epfl.ch/trac/scala/browser/scala/trunk/test/files/run/t45...

Great work!

-jason

iulian dragos 3
Joined: 2011-02-21,
User offline. Last seen 42 years 45 weeks ago.
Re: Nested object regression

On Wed, May 11, 2011 at 3:27 PM, Jason Zaugg wrote:
> 2011/5/11 √iktor Ҡlang :
>>
>>
>> On Wed, May 11, 2011 at 2:40 PM, Hubert Plociniczak
>> wrote:
>>> Fixed. Thanks for reporting it.
>>
>> Woot! Yay for Hubert!
>
> And Iulian, by the looks, for the epic test case.
>
>  http://lampsvn.epfl.ch/trac/scala/browser/scala/trunk/test/files/run/t4565_2.scala?rev=24923

Even better one, in
http://lampsvn.epfl.ch/trac/scala/browser/scala/trunk/test/files/run/inn...

(unfortunately the 3-level deep test that I initially provided
couldn't 'scale' to multithreaded tests and more nesting contexts)..

iulian

>
> Great work!
>
> -jason
>

Jason Zaugg
Joined: 2009-05-18,
User offline. Last seen 38 weeks 5 days ago.
Re: Nested object regression
SI-4565 was a regression in the release candidate for Scala 2.9.0, discovered at the last minute.
I just noticed that it also regressed from 2.8.1 to 2.8.2. Jira seems to be out of action right now, but I'll reopen the ticket when it's back.
-jason
Welcome to Scala version 2.8.2.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_29).Type in expressions to have them evaluated.Type :help for more information.
scala> def foo = { object A; def a(x: Any) = x == A; a(A)}foo: Boolean
scala> foores0: Boolean = true
scala> trait T { def foo = { object A; def a(x: Any) = x == A; a(A)} }; defined trait T
scala> new T{}.foores1: Boolean = false
On Wed, May 11, 2011 at 7:43 AM, Jason Zaugg <jzaugg [at] gmail [dot] com> wrote:
Sorry I didn't find this sooner, but this one is a silent killer:

https://lampsvn.epfl.ch/trac/scala/ticket/4565

 scala> def foo = { object A; def a(x: Any) = x == A; a(A)}
 foo: Boolean

 scala> foo
 res9: Boolean = true

 scala> trait T { def foo = { object A; def a(x: Any) = x == A; a(A)} };
 defined trait T

 scala> new T{}.foo
 res10: Boolean = false

-jason

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland