[vala/0.48] codegen: Drop confusing warning when accessing interface members
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.48] codegen: Drop confusing warning when accessing interface members
- Date: Mon, 21 Mar 2022 08:17:09 +0000 (UTC)
commit 2f4d4921955b0d0cbd8b193248935707c27840b8
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue Mar 8 22:54:09 2022 +0100
codegen: Drop confusing warning when accessing interface members
Making assumptions for member access using the current class is not correct.
Introduced by 0aace7bd6d3ec72e77f4eabbb7d5fffd3b2e86a8
codegen/valaccodebasemodule.vala | 4 ----
tests/Makefile.am | 1 +
tests/objects/interface-parameter-nowrapper.vala | 20 ++++++++++++++++++++
3 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 94a31b3f5..4c7e0f73c 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -2487,10 +2487,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
return new CCodeIdentifier ("%s_%s_parent_iface".printf (get_ccode_lower_case_name
(current_class), get_ccode_lower_case_name (iface)));
}
- if (!current_class.is_a (iface)) {
- Report.warning (current_class.source_reference, "internal: `%s' is not a `%s'".printf
(current_class.get_full_name (), iface.get_full_name ()));
- }
-
var vcast = new CCodeFunctionCall (new CCodeIdentifier ("G_TYPE_INSTANCE_GET_INTERFACE"));
vcast.add_argument (get_this_cexpression ());
vcast.add_argument (new CCodeIdentifier (get_ccode_type_id (iface)));
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d3958f666..b282f1e2d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -492,6 +492,7 @@ TESTS = \
objects/interface-abstract-async-override.vala \
objects/interface-async-captured-generic.vala \
objects/interface-generics.vala \
+ objects/interface-parameter-nowrapper.vala \
objects/interface-property-base-access.vala \
objects/interface-property-base-impl.vala \
objects/interface-property-delegate.vala \
diff --git a/tests/objects/interface-parameter-nowrapper.vala
b/tests/objects/interface-parameter-nowrapper.vala
new file mode 100644
index 000000000..e10915b9a
--- /dev/null
+++ b/tests/objects/interface-parameter-nowrapper.vala
@@ -0,0 +1,20 @@
+interface IFoo {
+ [NoWrapper]
+ public abstract int foo ();
+}
+
+class Bar {
+ public Bar (IFoo foo) {
+ assert (foo.foo () == 42);
+ }
+}
+
+class Foo : IFoo {
+ public int foo () {
+ return 42;
+ }
+}
+
+void main () {
+ new Bar (new Foo ());
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]