diff --git a/TestSuite/CompilationSamples/PABCSystem.pas b/TestSuite/CompilationSamples/PABCSystem.pas index 009cc26e3..29428fb81 100644 --- a/TestSuite/CompilationSamples/PABCSystem.pas +++ b/TestSuite/CompilationSamples/PABCSystem.pas @@ -8212,7 +8212,7 @@ function LogN(base, x: real) := Math.Log(x) / Math.Log(base); function Sqrt(x: real) := Math.Sqrt(x); -function Sqr(x: integer): int64 := x * x; +function Sqr(x: integer): int64 := int64(x) * int64(x); function Sqr(x: shortint): integer := x * x; @@ -8222,11 +8222,11 @@ function Sqr(x: BigInteger): BigInteger := x * x; function Sqr(x: byte): integer := x * x; -function Sqr(x: word): uint64 := x * x; +function Sqr(x: word): uint64 := uint64(x) * uint64(x); -function Sqr(x: longword): uint64 := x * x; +function Sqr(x: longword): uint64 := uint64(x) * uint64(x); -function Sqr(x: int64): int64 := x * x; +function Sqr(x: int64): int64 := int64(x) * int64(x); function Sqr(x: uint64): uint64 := x * x; diff --git a/TestSuite/lambdas_generics10.pas b/TestSuite/lambdas_generics10.pas new file mode 100644 index 000000000..6eefca952 --- /dev/null +++ b/TestSuite/lambdas_generics10.pas @@ -0,0 +1,26 @@ +type + + t0 = class + where T: t0; + b: boolean; + + static procedure p1(a: T); + begin + var f: Func := o -> o.b; + assert(f(a)); + end; + + static procedure p2(a: T); + begin + assert(a.b); + end; + end; + + t1 = class(t0) end; + +begin + var a := new t1; + a.b := true; + t1.p1(a); + t1.p2(a); +end. \ No newline at end of file diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index fb08ac26d..77383ff7c 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -11974,6 +11974,8 @@ namespace PascalABCCompiler.TreeConverter { make_attributes_for_declaration(_type_declaration, ctn); } + if (cl_def.keyword == class_keyword.Class || cl_def.keyword == class_keyword.Interface) + ctn.is_class = true;//nado ranshe pomechat kak is_class if (is_generic) { if (predefined_generic) @@ -12011,6 +12013,7 @@ namespace PascalABCCompiler.TreeConverter AddError(get_location(cl_def.class_parents.types[i]), "PARTIAL_CLASS_PARENTS_MISMATCH"); }*/ } + visit_where_list(cl_def.where_section); CheckWaitedRefTypes(ctn);