[chuck-users] incorrect compiler error

Michael Heuer heuermh at gmail.com
Wed Feb 3 18:38:38 EST 2010


The following appears to be a bug in the compiler

Foo.ck:

public class Foo
{
  Baz baz;

  fun Bar bar()
  {
    return baz;
  }
}

class Bar
{
}

class Baz extends Bar
{
}

[Foo.ck]:line(7): function 'bar at 0@Foo' was defined with return type
'Bar' -- but returning type 'Baz'
[Foo.ck]: ...in function 'bar'


Changing the definition order solves the problem

class Bar
{
}

class Baz extends Bar
{
}

public class Foo
{
  Baz baz;

  fun Bar bar()
  {
    return baz;
  }
}

   michael


More information about the chuck-users mailing list