allow overridden return types to be a subclass of the base class return type.
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/bc9edf35 Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/bc9edf35 Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/bc9edf35 Branch: refs/heads/develop Commit: bc9edf35a3f445cc50170b0c94e169570ab993ba Parents: 8ea2b99 Author: Alex Harui <[email protected]> Authored: Fri Mar 18 13:42:22 2016 -0700 Committer: Alex Harui <[email protected]> Committed: Mon Mar 21 21:01:44 2016 -0700 ---------------------------------------------------------------------- .../codegen/js/flexjs/TestFlexJSProject.java | 43 +++++++++ .../flexjs/projects/bad_overrides/Test.as | 43 +++++++++ .../projects/bad_overrides/Test_result.js | 94 ++++++++++++++++++++ .../flexjs/projects/bad_overrides/classes/A.as | 41 +++++++++ .../projects/bad_overrides/classes/A_result.js | 92 +++++++++++++++++++ .../flexjs/projects/bad_overrides/classes/B.as | 25 ++++++ .../projects/bad_overrides/classes/B_result.js | 69 ++++++++++++++ .../flexjs/projects/bad_overrides/classes/C.as | 25 ++++++ .../projects/bad_overrides/classes/C_result.js | 69 ++++++++++++++ .../projects/bad_overrides/interfaces/IA.as | 28 ++++++ .../bad_overrides/interfaces/IA_result.js | 69 ++++++++++++++ .../projects/bad_overrides/interfaces/IB.as | 22 +++++ .../bad_overrides/interfaces/IB_result.js | 62 +++++++++++++ .../projects/bad_overrides/interfaces/IC.as | 22 +++++ .../bad_overrides/interfaces/IC_result.js | 62 +++++++++++++ .../flexjs/projects/overrides/Test.as | 43 +++++++++ .../flexjs/projects/overrides/Test_result.js | 94 ++++++++++++++++++++ .../flexjs/projects/overrides/classes/A.as | 41 +++++++++ .../projects/overrides/classes/A_result.js | 92 +++++++++++++++++++ .../flexjs/projects/overrides/classes/B.as | 25 ++++++ .../projects/overrides/classes/B_result.js | 69 ++++++++++++++ .../flexjs/projects/overrides/classes/C.as | 25 ++++++ .../projects/overrides/classes/C_result.js | 74 +++++++++++++++ .../flexjs/projects/overrides/interfaces/IA.as | 28 ++++++ .../projects/overrides/interfaces/IA_result.js | 69 ++++++++++++++ .../flexjs/projects/overrides/interfaces/IB.as | 22 +++++ .../projects/overrides/interfaces/IB_result.js | 62 +++++++++++++ .../flexjs/projects/overrides/interfaces/IC.as | 22 +++++ .../projects/overrides/interfaces/IC_result.js | 65 ++++++++++++++ .../internal/projects/FlexJSProject.java | 10 +++ .../definitions/FunctionDefinition.java | 2 +- .../internal/projects/CompilerProject.java | 5 ++ .../compiler/projects/ICompilerProject.java | 7 ++ 33 files changed, 1520 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java index a82736c..feba941 100644 --- a/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java +++ b/compiler.jx.tests/src/org/apache/flex/compiler/internal/codegen/js/flexjs/TestFlexJSProject.java @@ -126,6 +126,49 @@ public class TestFlexJSProject extends TestGoogProject } @Test + public void test_Overrides() + { + String testDirPath = projectDirPath + "/overrides"; + + String fileName = "Test"; + + sourcePath = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + projectDirPath + "/overrides").getPath(); + + StringBuilder sb = new StringBuilder(); + List<String> compiledFileNames = compileProject(fileName, testDirPath, sb, false); + + assertProjectOut(compiledFileNames, testDirPath); + } + + @Test + public void test_Bad_Overrides() + { + String testDirPath = projectDirPath + "/bad_overrides"; + + String fileName = "Test"; + + sourcePath = new File(TestAdapterFactory.getTestAdapter().getUnitTestBaseDir(), + projectDirPath + "/bad_overrides").getPath(); + + StringBuilder sb = new StringBuilder(); + compileProject(fileName, testDirPath, sb, false); + + String out = sb.toString(); + out = out.replace("\\", "/"); + + String expected = "test-files/flexjs/projects/bad_overrides/Test.as(31:29)\n" + + "interface method someFunction in interface IA is implemented with an incompatible signature in class Test\n" + + "test-files/flexjs/projects/bad_overrides/Test.as(36:26)\n" + + "interface method someOtherFunction in interface IA is implemented with an incompatible signature in class Test\n" + + "test-files/flexjs/projects/bad_overrides/Test.as(31:29)\n" + + "Incompatible override.\n" + + "test-files/flexjs/projects/bad_overrides/Test.as(36:26)\n" + + "Incompatible override.\n"; + assertThat(out, is(expected)); + } + + @Test public void test_PackageConflict_AmbiguousDefinition() { String testDirPath = projectDirPath + "/package_conflicts_ambiguous_definition"; http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/Test.as ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/Test.as b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/Test.as new file mode 100644 index 0000000..9190d6e --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/Test.as @@ -0,0 +1,43 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package +{ + import classes.A; + import classes.C; + import interfaces.IC; + + public class Test extends A + { + public function Test() + { + super(); + } + + override public function someFunction():C + { + return null; + } + + override public function someOtherFunction():IC + { + return null; + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/Test_result.js ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/Test_result.js b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/Test_result.js new file mode 100644 index 0000000..8f8fd20 --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/Test_result.js @@ -0,0 +1,94 @@ +/** + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Test + * + * @fileoverview + * + * @suppress {checkTypes|accessControls} + */ + +goog.provide('Test'); + +goog.require('classes.A'); + + + +/** + * @constructor + * @extends {classes.A} + */ +Test = function() { + Test.base(this, 'constructor'); +}; +goog.inherits(Test, classes.A); + + +/** + * @export + * @override + */ +Test.prototype.someFunction = function() { + return null; +}; + + +/** + * @export + * @override + */ +Test.prototype.someOtherFunction = function() { + return null; +}; + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +Test.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'Test', qName: 'Test'}] }; + + +/** + * Prevent renaming of class. Needed for reflection. + */ +goog.exportSymbol('Test', Test); + + + +/** + * Reflection + * + * @return {Object.<string, Function>} + */ +Test.prototype.FLEXJS_REFLECTION_INFO = function () { + return { + variables: function () { + return { + }; + }, + accessors: function () { + return { + }; + }, + methods: function () { + return { + 'Test': { type: '', declaredBy: 'Test'}, + 'someFunction': { type: 'C', declaredBy: 'Test'}, + 'someOtherFunction': { type: 'IC', declaredBy: 'Test'} + }; + } + }; +}; http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/A.as ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/A.as b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/A.as new file mode 100644 index 0000000..004a607 --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/A.as @@ -0,0 +1,41 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package classes +{ + import interfaces.IA; + import interfaces.IB; + + public class A implements IA + { + public function A() + { + } + + public function someFunction():B + { + return null; + } + + public function someOtherFunction():IB + { + return null; + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/A_result.js ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/A_result.js b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/A_result.js new file mode 100644 index 0000000..e3320af --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/A_result.js @@ -0,0 +1,92 @@ +/** + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * classes.A + * + * @fileoverview + * + * @suppress {checkTypes|accessControls} + */ + +goog.provide('classes.A'); + +goog.require('interfaces.IA'); + + + +/** + * @constructor + * @implements {interfaces.IA} + */ +classes.A = function() { +}; + + +/** + * @export + * @return {classes.B} + */ +classes.A.prototype.someFunction = function() { + return null; +}; + + +/** + * @export + * @return {interfaces.IB} + */ +classes.A.prototype.someOtherFunction = function() { + return null; +}; + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +classes.A.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'A', qName: 'classes.A'}], interfaces: [interfaces.IA] }; + + +/** + * Prevent renaming of class. Needed for reflection. + */ +goog.exportSymbol('classes.A', classes.A); + + + +/** + * Reflection + * + * @return {Object.<string, Function>} + */ +classes.A.prototype.FLEXJS_REFLECTION_INFO = function () { + return { + variables: function () { + return { + }; + }, + accessors: function () { + return { + }; + }, + methods: function () { + return { + 'A': { type: '', declaredBy: 'classes.A'}, + 'someFunction': { type: 'B', declaredBy: 'classes.A'}, + 'someOtherFunction': { type: 'IB', declaredBy: 'classes.A'} + }; + } + }; +}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/B.as ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/B.as b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/B.as new file mode 100644 index 0000000..b410e59 --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/B.as @@ -0,0 +1,25 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package classes +{ + public class B + { + public function B() {} + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/B_result.js ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/B_result.js b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/B_result.js new file mode 100644 index 0000000..8aaa2f7 --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/B_result.js @@ -0,0 +1,69 @@ +/** + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * classes.B + * + * @fileoverview + * + * @suppress {checkTypes|accessControls} + */ + +goog.provide('classes.B'); + + + +/** + * @constructor + */ +classes.B = function() { +}; + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +classes.B.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'B', qName: 'classes.B'}] }; + + +/** + * Prevent renaming of class. Needed for reflection. + */ +goog.exportSymbol('classes.B', classes.B); + + + +/** + * Reflection + * + * @return {Object.<string, Function>} + */ +classes.B.prototype.FLEXJS_REFLECTION_INFO = function () { + return { + variables: function () { + return { + }; + }, + accessors: function () { + return { + }; + }, + methods: function () { + return { + 'B': { type: '', declaredBy: 'classes.B'} + }; + } + }; +}; http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/C.as ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/C.as b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/C.as new file mode 100644 index 0000000..d414a26 --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/C.as @@ -0,0 +1,25 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package classes +{ + public class C + { + public function C() {} + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/C_result.js ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/C_result.js b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/C_result.js new file mode 100644 index 0000000..46f094f --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/classes/C_result.js @@ -0,0 +1,69 @@ +/** + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * classes.C + * + * @fileoverview + * + * @suppress {checkTypes|accessControls} + */ + +goog.provide('classes.C'); + + + +/** + * @constructor + */ +classes.C = function() { +}; + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +classes.C.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'C', qName: 'classes.C'}] }; + + +/** + * Prevent renaming of class. Needed for reflection. + */ +goog.exportSymbol('classes.C', classes.C); + + + +/** + * Reflection + * + * @return {Object.<string, Function>} + */ +classes.C.prototype.FLEXJS_REFLECTION_INFO = function () { + return { + variables: function () { + return { + }; + }, + accessors: function () { + return { + }; + }, + methods: function () { + return { + 'C': { type: '', declaredBy: 'classes.C'} + }; + } + }; +}; http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IA.as ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IA.as b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IA.as new file mode 100644 index 0000000..6f363bc --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IA.as @@ -0,0 +1,28 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package interfaces +{ + import classes.B; + + public interface IA + { + function someFunction():B; + function someOtherFunction():IB; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IA_result.js ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IA_result.js b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IA_result.js new file mode 100644 index 0000000..04220e1 --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IA_result.js @@ -0,0 +1,69 @@ +/** + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * interfaces.IA + * + * @fileoverview + * + * @suppress {checkTypes|accessControls} + */ + +goog.provide('interfaces.IA'); + + + + +/** + * @interface + */ +interfaces.IA = function() { +}; +interfaces.IA.prototype.someFunction = function() { +}; +interfaces.IA.prototype.someOtherFunction = function() { +}; + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +interfaces.IA.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'IA', qName: 'interfaces.IA'}] }; + + + +/** + * Reflection + * + * @return {Object.<string, Function>} + */ +interfaces.IA.prototype.FLEXJS_REFLECTION_INFO = function () { + return { + variables: function () { + return { + }; + }, + accessors: function () { + return { + }; + }, + methods: function () { + return { + 'someFunction': { type: 'B', declaredBy: 'interfaces.IA'}, + 'someOtherFunction': { type: 'IB', declaredBy: 'interfaces.IA'} + }; + } + }; +}; http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IB.as ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IB.as b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IB.as new file mode 100644 index 0000000..a995635 --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IB.as @@ -0,0 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package interfaces +{ + public interface IB {} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IB_result.js ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IB_result.js b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IB_result.js new file mode 100644 index 0000000..01a7fe6 --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IB_result.js @@ -0,0 +1,62 @@ +/** + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * interfaces.IB + * + * @fileoverview + * + * @suppress {checkTypes|accessControls} + */ + +goog.provide('interfaces.IB'); + + + +/** + * @interface + */ +interfaces.IB = function() { +}; + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +interfaces.IB.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'IB', qName: 'interfaces.IB'}] }; + + + +/** + * Reflection + * + * @return {Object.<string, Function>} + */ +interfaces.IB.prototype.FLEXJS_REFLECTION_INFO = function () { + return { + variables: function () { + return { + }; + }, + accessors: function () { + return { + }; + }, + methods: function () { + return { + }; + } + }; +}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IC.as ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IC.as b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IC.as new file mode 100644 index 0000000..3a650c7 --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IC.as @@ -0,0 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package interfaces +{ + public interface IC {} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IC_result.js ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IC_result.js b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IC_result.js new file mode 100644 index 0000000..f9b77c6 --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/bad_overrides/interfaces/IC_result.js @@ -0,0 +1,62 @@ +/** + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * interfaces.IC + * + * @fileoverview + * + * @suppress {checkTypes|accessControls} + */ + +goog.provide('interfaces.IC'); + + + +/** + * @interface + */ +interfaces.IC = function() { +}; + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +interfaces.IC.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'IC', qName: 'interfaces.IC'}]}; + + + +/** + * Reflection + * + * @return {Object.<string, Function>} + */ +interfaces.IC.prototype.FLEXJS_REFLECTION_INFO = function () { + return { + variables: function () { + return { + }; + }, + accessors: function () { + return { + }; + }, + methods: function () { + return { + }; + } + }; +}; http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/overrides/Test.as ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/overrides/Test.as b/compiler.jx.tests/test-files/flexjs/projects/overrides/Test.as new file mode 100644 index 0000000..9190d6e --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/overrides/Test.as @@ -0,0 +1,43 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package +{ + import classes.A; + import classes.C; + import interfaces.IC; + + public class Test extends A + { + public function Test() + { + super(); + } + + override public function someFunction():C + { + return null; + } + + override public function someOtherFunction():IC + { + return null; + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/overrides/Test_result.js ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/overrides/Test_result.js b/compiler.jx.tests/test-files/flexjs/projects/overrides/Test_result.js new file mode 100644 index 0000000..8f8fd20 --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/overrides/Test_result.js @@ -0,0 +1,94 @@ +/** + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Test + * + * @fileoverview + * + * @suppress {checkTypes|accessControls} + */ + +goog.provide('Test'); + +goog.require('classes.A'); + + + +/** + * @constructor + * @extends {classes.A} + */ +Test = function() { + Test.base(this, 'constructor'); +}; +goog.inherits(Test, classes.A); + + +/** + * @export + * @override + */ +Test.prototype.someFunction = function() { + return null; +}; + + +/** + * @export + * @override + */ +Test.prototype.someOtherFunction = function() { + return null; +}; + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +Test.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'Test', qName: 'Test'}] }; + + +/** + * Prevent renaming of class. Needed for reflection. + */ +goog.exportSymbol('Test', Test); + + + +/** + * Reflection + * + * @return {Object.<string, Function>} + */ +Test.prototype.FLEXJS_REFLECTION_INFO = function () { + return { + variables: function () { + return { + }; + }, + accessors: function () { + return { + }; + }, + methods: function () { + return { + 'Test': { type: '', declaredBy: 'Test'}, + 'someFunction': { type: 'C', declaredBy: 'Test'}, + 'someOtherFunction': { type: 'IC', declaredBy: 'Test'} + }; + } + }; +}; http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/A.as ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/A.as b/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/A.as new file mode 100644 index 0000000..004a607 --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/A.as @@ -0,0 +1,41 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package classes +{ + import interfaces.IA; + import interfaces.IB; + + public class A implements IA + { + public function A() + { + } + + public function someFunction():B + { + return null; + } + + public function someOtherFunction():IB + { + return null; + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/A_result.js ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/A_result.js b/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/A_result.js new file mode 100644 index 0000000..e3320af --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/A_result.js @@ -0,0 +1,92 @@ +/** + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * classes.A + * + * @fileoverview + * + * @suppress {checkTypes|accessControls} + */ + +goog.provide('classes.A'); + +goog.require('interfaces.IA'); + + + +/** + * @constructor + * @implements {interfaces.IA} + */ +classes.A = function() { +}; + + +/** + * @export + * @return {classes.B} + */ +classes.A.prototype.someFunction = function() { + return null; +}; + + +/** + * @export + * @return {interfaces.IB} + */ +classes.A.prototype.someOtherFunction = function() { + return null; +}; + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +classes.A.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'A', qName: 'classes.A'}], interfaces: [interfaces.IA] }; + + +/** + * Prevent renaming of class. Needed for reflection. + */ +goog.exportSymbol('classes.A', classes.A); + + + +/** + * Reflection + * + * @return {Object.<string, Function>} + */ +classes.A.prototype.FLEXJS_REFLECTION_INFO = function () { + return { + variables: function () { + return { + }; + }, + accessors: function () { + return { + }; + }, + methods: function () { + return { + 'A': { type: '', declaredBy: 'classes.A'}, + 'someFunction': { type: 'B', declaredBy: 'classes.A'}, + 'someOtherFunction': { type: 'IB', declaredBy: 'classes.A'} + }; + } + }; +}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/B.as ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/B.as b/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/B.as new file mode 100644 index 0000000..b410e59 --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/B.as @@ -0,0 +1,25 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package classes +{ + public class B + { + public function B() {} + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/B_result.js ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/B_result.js b/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/B_result.js new file mode 100644 index 0000000..8aaa2f7 --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/B_result.js @@ -0,0 +1,69 @@ +/** + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * classes.B + * + * @fileoverview + * + * @suppress {checkTypes|accessControls} + */ + +goog.provide('classes.B'); + + + +/** + * @constructor + */ +classes.B = function() { +}; + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +classes.B.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'B', qName: 'classes.B'}] }; + + +/** + * Prevent renaming of class. Needed for reflection. + */ +goog.exportSymbol('classes.B', classes.B); + + + +/** + * Reflection + * + * @return {Object.<string, Function>} + */ +classes.B.prototype.FLEXJS_REFLECTION_INFO = function () { + return { + variables: function () { + return { + }; + }, + accessors: function () { + return { + }; + }, + methods: function () { + return { + 'B': { type: '', declaredBy: 'classes.B'} + }; + } + }; +}; http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/C.as ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/C.as b/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/C.as new file mode 100644 index 0000000..e2e4c8f --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/C.as @@ -0,0 +1,25 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package classes +{ + public class C extends B + { + public function C() {} + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/C_result.js ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/C_result.js b/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/C_result.js new file mode 100644 index 0000000..208d51c --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/overrides/classes/C_result.js @@ -0,0 +1,74 @@ +/** + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * classes.C + * + * @fileoverview + * + * @suppress {checkTypes|accessControls} + */ + +goog.provide('classes.C'); + +goog.require('classes.B'); + + + +/** + * @constructor + * @extends {classes.B} + */ +classes.C = function() { + classes.C.base(this, 'constructor'); +}; +goog.inherits(classes.C, classes.B); + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +classes.C.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'C', qName: 'classes.C'}] }; + + +/** + * Prevent renaming of class. Needed for reflection. + */ +goog.exportSymbol('classes.C', classes.C); + + + +/** + * Reflection + * + * @return {Object.<string, Function>} + */ +classes.C.prototype.FLEXJS_REFLECTION_INFO = function () { + return { + variables: function () { + return { + }; + }, + accessors: function () { + return { + }; + }, + methods: function () { + return { + 'C': { type: '', declaredBy: 'classes.C'} + }; + } + }; +}; http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IA.as ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IA.as b/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IA.as new file mode 100644 index 0000000..6f363bc --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IA.as @@ -0,0 +1,28 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package interfaces +{ + import classes.B; + + public interface IA + { + function someFunction():B; + function someOtherFunction():IB; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IA_result.js ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IA_result.js b/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IA_result.js new file mode 100644 index 0000000..04220e1 --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IA_result.js @@ -0,0 +1,69 @@ +/** + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * interfaces.IA + * + * @fileoverview + * + * @suppress {checkTypes|accessControls} + */ + +goog.provide('interfaces.IA'); + + + + +/** + * @interface + */ +interfaces.IA = function() { +}; +interfaces.IA.prototype.someFunction = function() { +}; +interfaces.IA.prototype.someOtherFunction = function() { +}; + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +interfaces.IA.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'IA', qName: 'interfaces.IA'}] }; + + + +/** + * Reflection + * + * @return {Object.<string, Function>} + */ +interfaces.IA.prototype.FLEXJS_REFLECTION_INFO = function () { + return { + variables: function () { + return { + }; + }, + accessors: function () { + return { + }; + }, + methods: function () { + return { + 'someFunction': { type: 'B', declaredBy: 'interfaces.IA'}, + 'someOtherFunction': { type: 'IB', declaredBy: 'interfaces.IA'} + }; + } + }; +}; http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IB.as ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IB.as b/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IB.as new file mode 100644 index 0000000..a995635 --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IB.as @@ -0,0 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package interfaces +{ + public interface IB {} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IB_result.js ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IB_result.js b/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IB_result.js new file mode 100644 index 0000000..01a7fe6 --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IB_result.js @@ -0,0 +1,62 @@ +/** + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * interfaces.IB + * + * @fileoverview + * + * @suppress {checkTypes|accessControls} + */ + +goog.provide('interfaces.IB'); + + + +/** + * @interface + */ +interfaces.IB = function() { +}; + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +interfaces.IB.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'IB', qName: 'interfaces.IB'}] }; + + + +/** + * Reflection + * + * @return {Object.<string, Function>} + */ +interfaces.IB.prototype.FLEXJS_REFLECTION_INFO = function () { + return { + variables: function () { + return { + }; + }, + accessors: function () { + return { + }; + }, + methods: function () { + return { + }; + } + }; +}; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IC.as ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IC.as b/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IC.as new file mode 100644 index 0000000..b2440bf --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IC.as @@ -0,0 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You under the Apache License, Version 2.0 +// (the "License"); you may not use this file except in compliance with +// the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +//////////////////////////////////////////////////////////////////////////////// +package interfaces +{ + public interface IC extends IB {} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IC_result.js ---------------------------------------------------------------------- diff --git a/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IC_result.js b/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IC_result.js new file mode 100644 index 0000000..1af780a --- /dev/null +++ b/compiler.jx.tests/test-files/flexjs/projects/overrides/interfaces/IC_result.js @@ -0,0 +1,65 @@ +/** + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * interfaces.IC + * + * @fileoverview + * + * @suppress {checkTypes|accessControls} + */ + +goog.provide('interfaces.IC'); + +goog.require('interfaces.IB'); + + + +/** + * @interface + * @extends {interfaces.IB} + */ +interfaces.IC = function() { +}; + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +interfaces.IC.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'IC', qName: 'interfaces.IC'}], interfaces: [interfaces.IB] }; + + + +/** + * Reflection + * + * @return {Object.<string, Function>} + */ +interfaces.IC.prototype.FLEXJS_REFLECTION_INFO = function () { + return { + variables: function () { + return { + }; + }, + accessors: function () { + return { + }; + }, + methods: function () { + return { + }; + } + }; +}; http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java ---------------------------------------------------------------------- diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java b/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java index bcae9ef..67657f7 100644 --- a/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java +++ b/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java @@ -26,6 +26,7 @@ import java.util.Set; import org.apache.flex.compiler.common.DependencyType; import org.apache.flex.compiler.definitions.IDefinition; +import org.apache.flex.compiler.definitions.ITypeDefinition; import org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSEmitterTokens; import org.apache.flex.compiler.internal.css.codegen.CSSCompilationSession; import org.apache.flex.compiler.internal.definitions.InterfaceDefinition; @@ -260,4 +261,13 @@ public class FlexJSProject extends FlexProject } } + @Override + public boolean isCompatibleOverrideReturnType(ITypeDefinition overrideDefinition, ITypeDefinition baseDefinition) + { + if (baseDefinition == overrideDefinition) + return true; + if (overrideDefinition.isInstanceOf(baseDefinition.getQualifiedName(), this)) + return true; + return false; + } } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler/src/org/apache/flex/compiler/internal/definitions/FunctionDefinition.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/internal/definitions/FunctionDefinition.java b/compiler/src/org/apache/flex/compiler/internal/definitions/FunctionDefinition.java index db64fee..7a59d80 100644 --- a/compiler/src/org/apache/flex/compiler/internal/definitions/FunctionDefinition.java +++ b/compiler/src/org/apache/flex/compiler/internal/definitions/FunctionDefinition.java @@ -455,7 +455,7 @@ public class FunctionDefinition extends ScopedDefinitionBase implements IFunctio // Compare return types. ITypeDefinition returnType1 = resolveReturnType(project); ITypeDefinition returnType2 = other.resolveReturnType(project); - if (returnType1 != returnType2) + if (!project.isCompatibleOverrideReturnType(returnType1, returnType2)) return false; // Compare parameters. http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler/src/org/apache/flex/compiler/internal/projects/CompilerProject.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/internal/projects/CompilerProject.java b/compiler/src/org/apache/flex/compiler/internal/projects/CompilerProject.java index 4914cc6..bf00fa8 100644 --- a/compiler/src/org/apache/flex/compiler/internal/projects/CompilerProject.java +++ b/compiler/src/org/apache/flex/compiler/internal/projects/CompilerProject.java @@ -996,4 +996,9 @@ public abstract class CompilerProject implements ICompilerProject { this.problems = problems; } + + public boolean isCompatibleOverrideReturnType(ITypeDefinition overrideDefinition, ITypeDefinition baseDefinition) + { + return (baseDefinition == overrideDefinition); + } } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/bc9edf35/compiler/src/org/apache/flex/compiler/projects/ICompilerProject.java ---------------------------------------------------------------------- diff --git a/compiler/src/org/apache/flex/compiler/projects/ICompilerProject.java b/compiler/src/org/apache/flex/compiler/projects/ICompilerProject.java index 2610c01..d4ef3ef 100644 --- a/compiler/src/org/apache/flex/compiler/projects/ICompilerProject.java +++ b/compiler/src/org/apache/flex/compiler/projects/ICompilerProject.java @@ -222,4 +222,11 @@ public interface ICompilerProject * can add a problem if they don't have another place to add them. */ void setProblems(Collection<ICompilerProblem> problems); + + /** + * @param overrideDefinition The definition overriding the base definition. + * @param baseDefinition The definition being overridden. + * @return True if compatible (default is if they are the same) + */ + boolean isCompatibleOverrideReturnType(ITypeDefinition overrideDefinition, ITypeDefinition baseDefinition); }
