renan-guimaraes / dwscript

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

OpOverloading using error (implicit typecast) #124

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Code:

function StrAddVar(AString : String; AVar : Variant) : String;
Begin

 Result := AString + AVar;

End;

operator << (string, variant) : string uses StrAddVar;

var s := '';

s := s << 5; // expected: right operand must be cast to variant
println(s);

Output:

Syntax Error: Invalid Operands [line: 12, column: 8]

Original issue reported on code.google.com by kazantse...@mail.ru on 5 Aug 2011 at 12:27

GoogleCodeExporter commented 9 years ago
There are currently no implicit conversions, the operator overloading is thus 
under strict type matching only.

Original comment by zar...@gmail.com on 5 Aug 2011 at 1:27