-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix compilation for "overloading over inheritance" (#1405)
Fixed varios compilation issues when "overloading over inheritance". For C++, adding a `using` directive for the parent functions in the child class. For JNI and CBridge, adding a signature suffix to the C functions. For Dart FFI no changes, since it has this logic in place already, due to overloading being absent from the Dart language as a concept entirely. Resolves: #1401 Signed-off-by: Daniel Kamkha <[email protected]>
- Loading branch information
1 parent
d961133
commit c46acb7
Showing
17 changed files
with
394 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
functional-tests/functional/input/lime/InheritanceOverloads.lime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Copyright (C) 2016-2022 HERE Europe B.V. | ||
# | ||
# 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. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# License-Filename: LICENSE | ||
|
||
package test | ||
|
||
interface ParentInterfaceOverloads { | ||
fun foo() | ||
@Dart("fooInt") | ||
fun foo(input: Int) | ||
fun bar() | ||
fun baz() | ||
} | ||
|
||
open class ParentClassOverloads { | ||
fun foo() | ||
@Dart("fooInt") | ||
fun foo(input: Int) | ||
fun bar() | ||
fun baz() | ||
} | ||
|
||
interface ChildInterfaceOverloads: ParentInterfaceOverloads { | ||
@Dart("fooString") | ||
fun foo(input: String) | ||
@Dart("barString") | ||
fun bar(input: String) | ||
} | ||
|
||
class ChildClassFromInterfaceOverloads: ParentInterfaceOverloads { | ||
@Dart("fooString") | ||
fun foo(input: String) | ||
@Dart("barString") | ||
fun bar(input: String) | ||
} | ||
|
||
class ChildClassFromClassOverloads: ParentClassOverloads { | ||
@Dart("fooString") | ||
fun foo(input: String) | ||
@Dart("barString") | ||
fun bar(input: String) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
gluecodium/src/test/resources/smoke/method_overloads/input/InheritanceOverloads.lime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Copyright (C) 2016-2022 HERE Europe B.V. | ||
# | ||
# 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. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# License-Filename: LICENSE | ||
|
||
package smoke | ||
|
||
interface ParentInterface { | ||
fun foo() | ||
fun foo(input: Int) | ||
fun bar() | ||
fun baz() | ||
} | ||
|
||
open class ParentClass { | ||
fun foo() | ||
fun foo(input: Int) | ||
fun bar() | ||
fun baz() | ||
} | ||
|
||
interface ChildInterfaceOverloads: ParentInterface { | ||
fun foo(input: String) | ||
fun bar(input: String) | ||
} | ||
|
||
class ChildClassFromInterfaceOverloads: ParentInterface { | ||
fun foo(input: String) | ||
fun bar(input: String) | ||
} | ||
|
||
class ChildClassFromClassOverloads: ParentClass { | ||
fun foo(input: String) | ||
fun bar(input: String) | ||
} |
23 changes: 23 additions & 0 deletions
23
.../method_overloads/output/android/jni/com_example_smoke_ChildClassFromInterfaceOverloads.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* | ||
*/ | ||
#pragma once | ||
#include <jni.h> | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
JNIEXPORT void JNICALL | ||
Java_com_example_smoke_ChildClassFromInterfaceOverloads_foo__Ljava_lang_String_2(JNIEnv* _jenv, jobject _jinstance, jstring jinput); | ||
JNIEXPORT void JNICALL | ||
Java_com_example_smoke_ChildClassFromInterfaceOverloads_bar__Ljava_lang_String_2(JNIEnv* _jenv, jobject _jinstance, jstring jinput); | ||
JNIEXPORT void JNICALL | ||
Java_com_example_smoke_ChildClassFromInterfaceOverloads_foo__(JNIEnv* _jenv, jobject _jinstance); | ||
JNIEXPORT void JNICALL | ||
Java_com_example_smoke_ChildClassFromInterfaceOverloads_foo__I(JNIEnv* _jenv, jobject _jinstance, jint jinput); | ||
JNIEXPORT void JNICALL | ||
Java_com_example_smoke_ChildClassFromInterfaceOverloads_bar(JNIEnv* _jenv, jobject _jinstance); | ||
JNIEXPORT void JNICALL | ||
Java_com_example_smoke_ChildClassFromInterfaceOverloads_baz(JNIEnv* _jenv, jobject _jinstance); | ||
#ifdef __cplusplus | ||
} | ||
#endif |
23 changes: 23 additions & 0 deletions
23
...smoke/method_overloads/output/android/jni/com_example_smoke_ChildInterfaceOverloadsImpl.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* | ||
*/ | ||
#pragma once | ||
#include <jni.h> | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
JNIEXPORT void JNICALL | ||
Java_com_example_smoke_ChildInterfaceOverloadsImpl_foo__Ljava_lang_String_2(JNIEnv* _jenv, jobject _jinstance, jstring jinput); | ||
JNIEXPORT void JNICALL | ||
Java_com_example_smoke_ChildInterfaceOverloadsImpl_bar__Ljava_lang_String_2(JNIEnv* _jenv, jobject _jinstance, jstring jinput); | ||
JNIEXPORT void JNICALL | ||
Java_com_example_smoke_ChildInterfaceOverloadsImpl_foo__(JNIEnv* _jenv, jobject _jinstance); | ||
JNIEXPORT void JNICALL | ||
Java_com_example_smoke_ChildInterfaceOverloadsImpl_foo__I(JNIEnv* _jenv, jobject _jinstance, jint jinput); | ||
JNIEXPORT void JNICALL | ||
Java_com_example_smoke_ChildInterfaceOverloadsImpl_bar(JNIEnv* _jenv, jobject _jinstance); | ||
JNIEXPORT void JNICALL | ||
Java_com_example_smoke_ChildInterfaceOverloadsImpl_baz(JNIEnv* _jenv, jobject _jinstance); | ||
#ifdef __cplusplus | ||
} | ||
#endif |
24 changes: 24 additions & 0 deletions
24
.../method_overloads/output/cbridge/include/smoke/cbridge_ChildClassFromInterfaceOverloads.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// | ||
#pragma once | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
#include "cbridge/include/BaseHandle.h" | ||
#include "cbridge/include/Export.h" | ||
#include <stdint.h> | ||
_GLUECODIUM_C_EXPORT void smoke_ChildClassFromInterfaceOverloads_release_handle(_baseRef handle); | ||
_GLUECODIUM_C_EXPORT _baseRef smoke_ChildClassFromInterfaceOverloads_copy_handle(_baseRef handle); | ||
_GLUECODIUM_C_EXPORT const void* smoke_ChildClassFromInterfaceOverloads_get_swift_object_from_wrapper_cache(_baseRef handle); | ||
_GLUECODIUM_C_EXPORT void smoke_ChildClassFromInterfaceOverloads_cache_swift_object_wrapper(_baseRef handle, const void* swift_pointer); | ||
_GLUECODIUM_C_EXPORT void smoke_ChildClassFromInterfaceOverloads_remove_swift_object_from_wrapper_cache(_baseRef handle); | ||
_GLUECODIUM_C_EXPORT void* smoke_ChildClassFromInterfaceOverloads_get_typed(_baseRef handle); | ||
_GLUECODIUM_C_EXPORT void smoke_ChildClassFromInterfaceOverloads_foo_String(_baseRef _instance, _baseRef input); | ||
_GLUECODIUM_C_EXPORT void smoke_ChildClassFromInterfaceOverloads_bar_String(_baseRef _instance, _baseRef input); | ||
_GLUECODIUM_C_EXPORT void smoke_ChildClassFromInterfaceOverloads_foo_(_baseRef _instance); | ||
_GLUECODIUM_C_EXPORT void smoke_ChildClassFromInterfaceOverloads_foo_Int(_baseRef _instance, int32_t input); | ||
_GLUECODIUM_C_EXPORT void smoke_ChildClassFromInterfaceOverloads_bar(_baseRef _instance); | ||
_GLUECODIUM_C_EXPORT void smoke_ChildClassFromInterfaceOverloads_baz(_baseRef _instance); | ||
#ifdef __cplusplus | ||
} | ||
#endif |
20 changes: 20 additions & 0 deletions
20
.../resources/smoke/method_overloads/output/cpp/include/smoke/ChildClassFromClassOverloads.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// ------------------------------------------------------------------------------------------------- | ||
// | ||
// | ||
// ------------------------------------------------------------------------------------------------- | ||
#pragma once | ||
#include "gluecodium/ExportGluecodiumCpp.h" | ||
#include "smoke/ParentClass.h" | ||
#include <string> | ||
namespace smoke { | ||
class _GLUECODIUM_CPP_EXPORT ChildClassFromClassOverloads: public ::smoke::ParentClass { | ||
public: | ||
ChildClassFromClassOverloads(); | ||
virtual ~ChildClassFromClassOverloads() = 0; | ||
public: | ||
virtual void foo( const ::std::string& input ) = 0; | ||
virtual void bar( const ::std::string& input ) = 0; | ||
using ::smoke::ParentClass::foo; | ||
using ::smoke::ParentClass::bar; | ||
}; | ||
} |
20 changes: 20 additions & 0 deletions
20
...ources/smoke/method_overloads/output/cpp/include/smoke/ChildClassFromInterfaceOverloads.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// ------------------------------------------------------------------------------------------------- | ||
// | ||
// | ||
// ------------------------------------------------------------------------------------------------- | ||
#pragma once | ||
#include "gluecodium/ExportGluecodiumCpp.h" | ||
#include "smoke/ParentInterface.h" | ||
#include <string> | ||
namespace smoke { | ||
class _GLUECODIUM_CPP_EXPORT ChildClassFromInterfaceOverloads: public ::smoke::ParentInterface { | ||
public: | ||
ChildClassFromInterfaceOverloads(); | ||
virtual ~ChildClassFromInterfaceOverloads() = 0; | ||
public: | ||
virtual void foo( const ::std::string& input ) = 0; | ||
virtual void bar( const ::std::string& input ) = 0; | ||
using ::smoke::ParentInterface::foo; | ||
using ::smoke::ParentInterface::bar; | ||
}; | ||
} |
Oops, something went wrong.