diff --git a/CodeExamples/TypeclassExample.pas b/CodeExamples/TypeclassExample.pas index 070bdfb6c..b1a637bad 100644 --- a/CodeExamples/TypeclassExample.pas +++ b/CodeExamples/TypeclassExample.pas @@ -18,7 +18,7 @@ end; begin var v1, v2, v3, res: integer; - res := Sum3&(v1, v2, v3); + res := Sum3&[integer](v1, v2, v3); Write(res); end. \ No newline at end of file diff --git a/CodeExamples/TypeclassTranslation.pas b/CodeExamples/TypeclassTranslation.pas index 6218679fb..1fb28e2a1 100644 --- a/CodeExamples/TypeclassTranslation.pas +++ b/CodeExamples/TypeclassTranslation.pas @@ -53,7 +53,13 @@ end; end;*) -//function Sum3(v1, v2, v3: T): T; where SumTCT: SumTC, constructor; +(* +function Sum3(v1, v2, v3: T): T; where SumTCT: SumTC, constructor; +begin + var s := ConceptSingleton&.&Instance; + Result := s.sum(v1, s.sum(v2, v3)); +end; +*) function Sum3(v1, v2, v3: T): T; where SumTC[T]; begin Result := SumTC&[T].sum(v1, SumTC&[T].sum(v2, v3)); @@ -61,6 +67,4 @@ end; begin write(Sum3&(1, 2, 3)); - - end. \ No newline at end of file diff --git a/SyntaxVisitors/TypeclassVisitors/ReplaceTypeclassVisitor.cs b/SyntaxVisitors/TypeclassVisitors/ReplaceTypeclassVisitor.cs index ff9bdceff..2749f14f8 100644 --- a/SyntaxVisitors/TypeclassVisitors/ReplaceTypeclassVisitor.cs +++ b/SyntaxVisitors/TypeclassVisitors/ReplaceTypeclassVisitor.cs @@ -223,6 +223,7 @@ namespace SyntaxVisitors.TypeclassVisitors { // TODO: Check tcr.name - typeclass from where // TODO: Check - that there is such typeclass with such args at where + // TODO: Ensure that we don't replace another constraint funciton call var str = tcr.template_params.params_list .Select(x => (x as named_type_reference).names[0].name) .Aggregate((tcr.name as ident).name, (x, y) => x + y);