From b24c527c7eea341e1429096aeaaa6a7e622875df Mon Sep 17 00:00:00 2001 From: Mikhalkovich Stanislav Date: Thu, 9 Jul 2020 23:54:10 +0300 Subject: [PATCH] fix #2279 --- Configuration/GlobalAssemblyInfo.cs | 2 +- Configuration/Version.defs | 4 ++-- Release/pabcversion.txt | 2 +- ReleaseGenerators/PascalABCNET_version.nsh | 2 +- TestSuite/qp2.pas | 11 +++++++++++ .../TreeConversion/semantic_checks_for_sugar.cs | 3 ++- 6 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 TestSuite/qp2.pas diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 9d7c65855..5de3e0463 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 = "6"; public const string Build = "3"; - public const string Revision = "2569"; + public const string Revision = "2570"; 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 9983d9b14..e554e129f 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%MINOR%=6 -%REVISION%=2569 %COREVERSION%=3 +%REVISION%=2570 +%MINOR%=6 %MAJOR%=3 diff --git a/Release/pabcversion.txt b/Release/pabcversion.txt index 92166aedd..f9a1f9676 100644 --- a/Release/pabcversion.txt +++ b/Release/pabcversion.txt @@ -1 +1 @@ -3.6.3.2569 +3.6.3.2570 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 79c3ebf51..47547ce07 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.6.3.2569' +!define VERSION '3.6.3.2570' diff --git a/TestSuite/qp2.pas b/TestSuite/qp2.pas new file mode 100644 index 000000000..beaccfdc9 --- /dev/null +++ b/TestSuite/qp2.pas @@ -0,0 +1,11 @@ +type + t1 = auto class + i: integer; + end; + +begin + + var a: array of t1 := Arr(new t1(2)); + var o := a?.First; + Assert((o as t1).i = 2) +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 17f082c8f..cff469192 100644 --- a/TreeConverter/TreeConversion/semantic_checks_for_sugar.cs +++ b/TreeConverter/TreeConversion/semantic_checks_for_sugar.cs @@ -122,7 +122,8 @@ namespace PascalABCCompiler.TreeConverter t = ctn2.compiled_original_generic.compiled_type; else if (av.type is compiled_type_node ctn1) t = ctn1.compiled_type; - + if (av.type.type_special_kind == SemanticTree.type_special_kind.array_kind) + return; if (!av.type.is_class && !av.type.IsInterface && !(t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>))) AddError(av.location, "OPERATOR_DQ_MUST_BE_USED_WITH_A_REFERENCE_TYPE_VALUETYPE"); }