diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 56209c7fa..b419fcf15 100644 --- a/Configuration/GlobalAssemblyInfo.cs +++ b/Configuration/GlobalAssemblyInfo.cs @@ -15,7 +15,7 @@ internal static class RevisionClass public const string Major = "3"; public const string Minor = "4"; public const string Build = "2"; - public const string Revision = "2036"; + public const string Revision = "2037"; public const string MainVersion = Major + "." + Minor; public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision; diff --git a/Configuration/Version.defs b/Configuration/Version.defs index 07d41d42d..e28ea4a4c 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%MINOR%=4 -%REVISION%=2036 %COREVERSION%=2 +%REVISION%=2037 +%MINOR%=4 %MAJOR%=3 diff --git a/Localization/DefaultLang.resources b/Localization/DefaultLang.resources index 8afaf9433..081091b0e 100644 Binary files a/Localization/DefaultLang.resources and b/Localization/DefaultLang.resources differ diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 550bb8e17..8079d10fd 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.4.2.2036' +!define VERSION '3.4.2.2037' diff --git a/TestSuite/CompilationSamples/WPFObjects.pas b/TestSuite/CompilationSamples/WPFObjects.pas index b6a590be1..eb001d259 100644 --- a/TestSuite/CompilationSamples/WPFObjects.pas +++ b/TestSuite/CompilationSamples/WPFObjects.pas @@ -242,7 +242,7 @@ type /// Правый нижний угол графического объекта property RightBottom: Point read Pnt(Left + Height,Top + Height); /// Угол поворота графического объекта (по часовой стрелке) - property RotateAngle: real read InvokeReal(()->rot.Angle) write Invoke(procedure->rot.Angle := value); + property RotateAngle: real read InvokeReal(()->rot.Angle) write Invoke(procedure->begin rot.CenterX := Width/2; rot.CenterY := Height/2; rot.Angle := value end); /// Множитель масштабирования объекта property ScaleFactor: real read InvokeReal(()->sca.ScaleX) write Invoke(()->begin (sca.ScaleX, sca.ScaleY) := (value,value); end); // Центр поворота графического объекта - запретил, т.к. это будет сбивать координаты объекта @@ -439,13 +439,24 @@ type CircleWPF = class(BoundedObjectWPF) private procedure InitOb2(x,y,r: real; c: GColor) := InitOb1(x-r,y-r,2*r,2*r,c,new System.Windows.Shapes.Ellipse()); - procedure WT(value: real) := (ob.Width,ob.Height) := (value,value); - procedure HT(value: real) := (ob.Width,ob.Height) := (value,value); + procedure WT(value: real) := begin (ob.Width,ob.Height) := (value,value); (gr.Width,gr.Height) := (value,value); end; + procedure HT(value: real) := begin (ob.Width,ob.Height) := (value,value); (gr.Width,gr.Height) := (value,value); end; + + {procedure Rad(value: real); + begin + var delta := value - gr.Width/2; + Left -= delta; + Top -= delta; + (gr.Width,gr.Height) := (value*2,value*2); + Element.Points := ChangePointCollection(value,n); + end;} + procedure Rad(value: real); begin //(ob as Ellipse).RenderedGeometry - Left -= value - ob.Width/2; - Top -= value - ob.Width/2; + Left -= value - gr.Width/2; + Top -= value - gr.Width/2; + (gr.Width,gr.Height) := (value*2,value*2); (ob.Width,ob.Height) := (value*2,value*2); end; function GetInternalGeometry: Geometry; override := (ob as Shape).RenderedGeometry; @@ -662,7 +673,7 @@ type write Invoke(()->begin Self.Element.bc := value; Self.Element.RecreateFormText; ob.InvalidateVisual end); /// Текст графического объекта property Text: string read InvokeString(()->Element.Text) - write Invoke(procedure->begin Self.Element.Text := value; Self.Element.RecreateFormText; ; Width := Self.Element.Width; Height := Self.Element.Height; ob.InvalidateVisual end); override; + write Invoke(procedure->begin Self.Element.Text := value; Self.Element.RecreateFormText; Width := Self.Element.Width; Height := Self.Element.Height; ob.InvalidateVisual end); override; /// Декоратор поворота объекта function WithRotate(da: real): TextWPF := inherited WithRotate(da) as TextWPF; end; diff --git a/TestSuite/question_point_Nullable.pas b/TestSuite/question_point_Nullable.pas new file mode 100644 index 000000000..a23b44df4 --- /dev/null +++ b/TestSuite/question_point_Nullable.pas @@ -0,0 +1,5 @@ +begin + var x: integer?; + var a := x?.ToString(); + Assert(a=nil); +end. \ No newline at end of file diff --git a/TestSuite/question_point_Nullable_2.pas b/TestSuite/question_point_Nullable_2.pas new file mode 100644 index 000000000..a78f39e64 --- /dev/null +++ b/TestSuite/question_point_Nullable_2.pas @@ -0,0 +1,14 @@ +type + T = record + y := 1; + function ToString: string; override := y.ToString; + end; + +function F(x: T?): string; +begin + Result := x?.ToString(); +end; + +begin + assert(f(new T)='1'); +end. \ No newline at end of file diff --git a/TreeConverter/TreeConversion/semantic_checks_for_sugar.cs b/TreeConverter/TreeConversion/semantic_checks_for_sugar.cs index 26ab185e9..4f4b02b7f 100644 --- a/TreeConverter/TreeConversion/semantic_checks_for_sugar.cs +++ b/TreeConverter/TreeConversion/semantic_checks_for_sugar.cs @@ -108,7 +108,13 @@ namespace PascalABCCompiler.TreeConverter public void semantic_check_dot_question(SyntaxTree.question_colon_expression qce) { var av = convert_strong((qce.condition as bin_expr).left); - if (!av.type.is_class) + Type t = null; + if (av.type is compiled_generic_instance_type_node ctn2) + t = ctn2.compiled_original_generic.compiled_type; + else if (av.type is compiled_type_node ctn1) + t = ctn1.compiled_type; + + if (!av.type.is_class && !(t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>))) AddError(av.location, "OPERATOR_DQ_MUST_BE_USED_WITH_A_REFERENCE_TYPE_VALUETYPE"); }