diff --git a/.github/workflows/buildandruntestslinux.yml b/.github/workflows/buildandruntestslinux.yml new file mode 100644 index 000000000..fba4fb362 --- /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: sh + +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 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)) diff --git a/_RebuildReleaseAndRunTests.sh b/_RebuildReleaseAndRunTests.sh index 3f5e5f56a..07cc623c5 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