ELENA-LANG / elena-lang

ELENA is a general-purpose language with late binding. It is multi-paradigm, combining features of functional and object-oriented programming. Rich set of tools are provided to deal with message dispatching : multi-methods, message qualifying, generic message handlers, run-time interfaces
https://elena-lang.github.io/
MIT License
236 stars 26 forks source link

Calling a named constructor from an implicit one #650

Closed arakov closed 5 months ago

arakov commented 6 months ago

Describe the bug The following code raises a warning :

warning 407: Message 'new' does not handled by the object

In reality the code fails:

sandbox'$private'B#class : Method new[1] not found
Call stack:
sandbox'program.function:#invoke:sandbox.l(24)
system'$private'entry.function:#invoke:app.l(28)
system'$private'entrySymbol#sym:app.l(79)

Aborted:ffffffff

To Reproduce

class B
{
   protected constructor new()
   {
      console.writeLine("new B")
   }
}

class C : B
{
   _arg1;

   constructor(arg1)
      <= super new() 
   {
      _arg1 := arg1
   }
}

public program()
{
   var c := new C("arg")
}

Expected behavior An error must be raised. A named constructor cannot be called from the implicit one

arakov commented 5 months ago

After reviewing the code, the following changes were made:

arakov commented 5 months ago

fixed in ELENA 6.1.1