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

[netbeans] default constructor argument and companion object => false error

3 replies
anli
Joined: 2008-08-19,
User offline. Last seen 1 day 2 hours ago.

Caoyuan,

For such code

object OC
class OC(v : Int = 1)

I have second line marked as an error with error's popup:

"constructor definition not allowed here
constructor OC is defined twice
constructor OC is defined twice"

(all things are from trunks, as always)

Caoyuan
Joined: 2009-01-18,
User offline. Last seen 42 years 45 weeks ago.
Re: [netbeans] default constructor argument and companion objec

Andrew Gaydenko wrote:
>
> Caoyuan,
>
> For such code
>
> object OC
> class OC(v : Int = 1)
>
> I have second line marked as an error with error's popup:
>
> "constructor definition not allowed here
> constructor OC is defined twice
> constructor OC is defined twice"
>
> (all things are from trunks, as always)
>
>

I noticed that before, It seems to be related to scalac. You can move
"object OC" to behind "class OC ..." definition to avoid it.

-Caoyuan

anli
Joined: 2008-08-19,
User offline. Last seen 1 day 2 hours ago.
Re: [netbeans] default constructor argument and companion objec

On Tuesday 20 October 2009 08:14:04 dcaoyuan wrote:
> Andrew Gaydenko wrote:
> > Caoyuan,
> >
> > For such code
> >
> > object OC
> > class OC(v : Int = 1)
> >
> > I have second line marked as an error with error's popup:
> >
> > "constructor definition not allowed here
> > constructor OC is defined twice
> > constructor OC is defined twice"
> >
> > (all things are from trunks, as always)
>
> I noticed that before, It seems to be related to scalac. You can move
> "object OC" to behind "class OC ..." definition to avoid it.

Caoyuan, sorry, it isn't clear to me. Do you mean, scalac has a bug?

Caoyuan
Joined: 2009-01-18,
User offline. Last seen 42 years 45 weeks ago.
Re: [netbeans] default constructor argument and companion obje

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