From 1b611fd47fe9c4023f76073bb2ca06a4f45d1050 Mon Sep 17 00:00:00 2001 From: Ivan Bondarev Date: Sun, 11 Apr 2021 11:54:18 +0200 Subject: [PATCH 1/6] #2469 --- TestSuite/errors/err0411.pas | 8 +++++ TestSuite/errors/err0412.pas | 8 +++++ TestSuite/errors/err0413.pas | 7 +++++ TestSuite/errors/err0414.pas | 8 +++++ TestSuite/explicitinterface12.pas | 26 ++++++++++++++++ .../TreeConversion/syntax_tree_visitor.cs | 31 ++++++++++++++----- 6 files changed, 80 insertions(+), 8 deletions(-) create mode 100644 TestSuite/errors/err0411.pas create mode 100644 TestSuite/errors/err0412.pas create mode 100644 TestSuite/errors/err0413.pas create mode 100644 TestSuite/errors/err0414.pas create mode 100644 TestSuite/explicitinterface12.pas diff --git a/TestSuite/errors/err0411.pas b/TestSuite/errors/err0411.pas new file mode 100644 index 000000000..04286c697 --- /dev/null +++ b/TestSuite/errors/err0411.pas @@ -0,0 +1,8 @@ +type + t1 = abstract class(System.Collections.IEnumerator) + // Падает только если НЕ указать System.Collections + public property IEnumerator.Current: object read nil; + + end; + +begin end. \ No newline at end of file diff --git a/TestSuite/errors/err0412.pas b/TestSuite/errors/err0412.pas new file mode 100644 index 000000000..377fbeb24 --- /dev/null +++ b/TestSuite/errors/err0412.pas @@ -0,0 +1,8 @@ +type + t1 = abstract class(System.Collections.IEnumerator) + // Падает только если НЕ указать System.Collections + public property System.Collections.IEnumerator.Current: object read nil; + + end; + +begin end. \ No newline at end of file diff --git a/TestSuite/errors/err0413.pas b/TestSuite/errors/err0413.pas new file mode 100644 index 000000000..4b5ec5e5f --- /dev/null +++ b/TestSuite/errors/err0413.pas @@ -0,0 +1,7 @@ +type + t1 = abstract class(System.Collections.Generic.IEnumerator) + public property IEnumerator.Current: integer read 2; + + end; + +begin end. \ No newline at end of file diff --git a/TestSuite/errors/err0414.pas b/TestSuite/errors/err0414.pas new file mode 100644 index 000000000..62d156950 --- /dev/null +++ b/TestSuite/errors/err0414.pas @@ -0,0 +1,8 @@ +type + t1 = abstract class(System.Collections.IEnumerator) + + public property System.Collections.IEnumerator.Current: object read nil; + + end; + +begin end. \ No newline at end of file diff --git a/TestSuite/explicitinterface12.pas b/TestSuite/explicitinterface12.pas new file mode 100644 index 000000000..ed83f2811 --- /dev/null +++ b/TestSuite/explicitinterface12.pas @@ -0,0 +1,26 @@ +type + t1 = class(System.Collections.Generic.IEnumerator) + + public property IEnumerator.Current: T read T(object(2)); + public property System.Collections.IEnumerator.Current: object read 3; + + public function System.Collections.IEnumerator.MoveNext: boolean; + begin + + end; + public procedure System.Collections.IEnumerator.Reset; + begin + + end; + + public procedure System.IDisposable.Dispose; + begin + + end; + end; + +begin + var obj := new t1; + assert((obj as IEnumerator).Current = 2); + assert(integer((obj as System.Collections.IEnumerator).Current) = 3); +end. \ No newline at end of file diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index 6e32ab230..be741d3d9 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -4279,19 +4279,34 @@ namespace PascalABCCompiler.TreeConverter AddError(new NameCannotHaveGenericParameters(_simple_property.property_name.ln[i].name, get_location(_simple_property.property_name.ln[i]))); var ntr = new SyntaxTree.named_type_reference(); + if (_simple_property.property_name.ln[_simple_property.property_name.ln.Count - 1] is template_type_name) + { + template_type_reference ttr = new template_type_reference(); + ttr.params_list = new template_param_list(); + ttr.params_list.source_context = _simple_property.property_name.ln[_simple_property.property_name.ln.Count - 1].source_context; + foreach (ident id in (_simple_property.property_name.ln[_simple_property.property_name.ln.Count - 1] as template_type_name).template_args.idents) + ttr.params_list.params_list.Add(new named_type_reference(id.name, id.source_context)); + for (var i = 0; i < _simple_property.property_name.ln.Count; i++) + { + ntr.Add(_simple_property.property_name.ln[i]); + } + ttr.name = ntr; + ttr.source_context = _simple_property.property_name.source_context; + ntr = ttr; + } + else for (var i = 0; i < _simple_property.property_name.ln.Count; i++) { - ntr.Add(new ident(_simple_property.property_name.ln[i].name+ - (_simple_property.property_name.ln[i] is template_type_name ? "`"+(_simple_property.property_name.ln[i] as template_type_name).template_args.Count :""), _simple_property.property_name.ln[i].source_context)); - + ntr.Add(_simple_property.property_name.ln[i]); } + + type_node tn = find_type(ntr, get_location(_simple_property.property_name)); - List sil = context.find_definition_node(ntr, get_location(_simple_property.property_name), true); - if (!(sil[0].sym_info as type_node).IsInterface) + if (!tn.IsInterface) AddError(get_location(_simple_property.property_name), "EXPECTED_INTERFACE"); - name = (sil[0].sym_info as type_node).BaseFullName + "." + name; - expl_interface = sil[0].sym_info as type_node; - sil = expl_interface.find_in_type(_simple_property.property_name.name); + name = tn.BaseFullName + "." + name; + expl_interface = tn; + List sil = expl_interface.find_in_type(_simple_property.property_name.name); if (sil == null) AddError(new MemberIsNotDeclaredInType(_simple_property.property_name, get_location(_simple_property.property_name), expl_interface)); if (!(sil[0].sym_info is property_node)) From 59980ffe54c581bdce6dafc5b25b7bf5a57103e2 Mon Sep 17 00:00:00 2001 From: Ivan Bondarev Date: Sun, 11 Apr 2021 13:51:40 +0200 Subject: [PATCH 2/6] ubuntu workflow --- .github/workflows/buildandruntestslinux.yml | 35 +++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/buildandruntestslinux.yml diff --git a/.github/workflows/buildandruntestslinux.yml b/.github/workflows/buildandruntestslinux.yml new file mode 100644 index 000000000..d71da7dd8 --- /dev/null +++ b/.github/workflows/buildandruntestslinux.yml @@ -0,0 +1,35 @@ +name: Build & Run all tests on Ubuntu (release) + +on: + workflow_dispatch: + + release: + types: + - created + +defaults: + run: + shell: cmd + +jobs: + build: + + name: Prepare and build on Ubuntu + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Build project in Release-mode, compile Pas-units, run tests + run: _RebuildReleaseAndRunTests.sh + timeout-minutes: 40 + env: + PABCNET_BUILD_MODE: Release + PABCNET_RUN_TESTS: false + PABCNET_INC_BUILD: false + PABCNET_VERBOSE: false + + #- name: Publish artifacts (5/5)... + # uses: actions/upload-artifact@v2 + # with: + # name: All_distros + # path: Release From 788b14bb4ff97d08729bd87653c66495fd71020e Mon Sep 17 00:00:00 2001 From: Ivan Bondarev Date: Sun, 11 Apr 2021 13:53:18 +0200 Subject: [PATCH 3/6] update --- .github/workflows/buildandruntestslinux.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/buildandruntestslinux.yml b/.github/workflows/buildandruntestslinux.yml index d71da7dd8..5bd41f384 100644 --- a/.github/workflows/buildandruntestslinux.yml +++ b/.github/workflows/buildandruntestslinux.yml @@ -7,10 +7,6 @@ on: types: - created -defaults: - run: - shell: cmd - jobs: build: From 7e6273eee06e4acd35a4c1efa85fc561f9d91525 Mon Sep 17 00:00:00 2001 From: Ivan Bondarev Date: Sun, 11 Apr 2021 13:54:56 +0200 Subject: [PATCH 4/6] update --- .github/workflows/buildandruntestslinux.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/buildandruntestslinux.yml b/.github/workflows/buildandruntestslinux.yml index 5bd41f384..ef7fd6d65 100644 --- a/.github/workflows/buildandruntestslinux.yml +++ b/.github/workflows/buildandruntestslinux.yml @@ -7,6 +7,10 @@ on: types: - created +defaults: + run: + shell: sh + jobs: build: From 19db553eefd5265422c172099cd30be925595276 Mon Sep 17 00:00:00 2001 From: Ivan Bondarev Date: Sun, 11 Apr 2021 13:58:21 +0200 Subject: [PATCH 5/6] update --- .github/workflows/buildandruntestslinux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/buildandruntestslinux.yml b/.github/workflows/buildandruntestslinux.yml index ef7fd6d65..fba4fb362 100644 --- a/.github/workflows/buildandruntestslinux.yml +++ b/.github/workflows/buildandruntestslinux.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v2 - name: Build project in Release-mode, compile Pas-units, run tests - run: _RebuildReleaseAndRunTests.sh + run: ./_RebuildReleaseAndRunTests.sh timeout-minutes: 40 env: PABCNET_BUILD_MODE: Release From f6d8fabc4cdfd1f4b164366a1dd3235279509380 Mon Sep 17 00:00:00 2001 From: Ivan Bondarev Date: Sun, 11 Apr 2021 14:08:49 +0200 Subject: [PATCH 6/6] removed PABCRtl from _RebuildReleaseAndRunTests --- _RebuildReleaseAndRunTests.sh | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/_RebuildReleaseAndRunTests.sh b/_RebuildReleaseAndRunTests.sh index 5b6351118..ef74247d2 100755 --- a/_RebuildReleaseAndRunTests.sh +++ b/_RebuildReleaseAndRunTests.sh @@ -16,28 +16,9 @@ export MONO_IOMAP=all cd ReleaseGenerators mono ../bin/pabcnetc.exe RebuildStandartModulesMono.pas /rebuild if [ $? -eq 0 ]; then - cd PABCRtl - mono ../../bin/pabcnetc.exe PABCRtl.pas /rebuild if [ $? -eq 0 ]; then - sn -Vr PABCRtl.dll - sn -R PABCRtl.dll KeyPair.snk - sn -Vu PABCRtl.dll - cp PABCRtl.dll ../../bin/Lib - mono ../../bin/pabcnetc.exe PABCRtl32.pas /rebuild - if [ $? -eq 0 ]; then - sn -Vr PABCRtl32.dll - sn -R PABCRtl32.dll KeyPair32.snk - sn -Vu PABCRtl32.dll - cp PABCRtl32.dll ../../bin/Lib - sudo gacutil -u PABCRtl - sudo gacutil -i ../../bin/Lib/PABCRtl.dll - cd .. - mono ../bin/pabcnetc.exe RebuildStandartModules.pas /rebuild - if [ $? -eq 0 ]; then - cd ../bin - mono TestRunner.exe - cd .. - fi - fi + cd ../bin + mono TestRunner.exe + cd .. fi fi