AArhin / dwscript

Automatically exported from code.google.com/p/dwscript
0 stars 0 forks source link

Methods overloading. Invalid resolving #263

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Code:

Type

 TObj = Class
  Procedure Proc;
  Begin
  End;
 End;

Type

 TObjEx = Class
  Procedure Proc(AString : String); Overload;
  Begin
  End; 
 End;

TObjEx.Create.Proc;

Output:

Syntax Error: There is no overloaded version of "Proc" that can be called with 
these arguments [line: 17, column: 15]

Original issue reported on code.google.com by kazantse...@mail.ru on 4 May 2012 at 6:11

GoogleCodeExporter commented 9 years ago
Full Code:

Type

 TObj = Class
  Procedure Proc;
  Begin
  End;
 End;

Type

 TObjEx = Class(TObj)
  Procedure Proc(AString : String); Overload;
  Begin
  End; 
 End;

TObjEx.Create.Proc; // OK

Type 

 THelper = Helper For TObj
  Procedure Proc(AString : String); Overload;
  Begin
  End;
 End;

TObj.Create.Proc; 

Output:

Syntax Error: There is no overloaded version of "Proc" that can be called with 
these arguments [line: 27, column: 13]

Original comment by kazantse...@mail.ru on 4 May 2012 at 6:20

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Type

 TStringHelper = Helper For String

  Procedure test; Overload; // without "Overload": Syntax Error: Too many arguments! [line: 21, column: 11]
  Begin
  End;

 End;

Type

 TStringHelper2 = Helper For String

  Procedure test(Count : Integer); Overload;
  Begin
  End;

 End;

('hello').test(5); // Syntax Error: There is no overloaded version of "test" 
that can be called with these arguments [line: 21, column: 11]

Procedure test(Const S : String; Count, Dummy : Integer); Overload; Helper;
Begin

 For Var Index := 1 To Count Do
  PrintLn(s);

End;

('hello').test(5); // Syntax Error: More arguments expected! [line: 32, column: 
11]

Original comment by kazantse...@mail.ru on 28 Feb 2013 at 8:46