summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2021-08-05 18:11:25 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2021-08-09 15:08:32 +0100
commit34e19f672ea361359205b7cac2d9a37239cb9736 (patch)
tree573c04c700b3d6678c0033e73ac80e35384c505f
parent358632577ea4254f29abeba86630dd6ce9a2da2c (diff)
downloadgobject-introspection-ebassi/symbol-collision.tar.gz
scanner: Mark colliding properties as not introspectableebassi/symbol-collision
We prefer methods, signals, and virtual methods to properties, in case of a collision.
-rw-r--r--giscanner/introspectablepass.py3
-rw-r--r--tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj-name-conflict.page18
-rw-r--r--tests/scanner/Regress-1.0-Python-expected/Regress.TestObj-name-conflict.page18
-rw-r--r--tests/scanner/Regress-1.0-expected.gir1
4 files changed, 4 insertions, 36 deletions
diff --git a/giscanner/introspectablepass.py b/giscanner/introspectablepass.py
index 6a999f9f..5bed3ef7 100644
--- a/giscanner/introspectablepass.py
+++ b/giscanner/introspectablepass.py
@@ -272,6 +272,7 @@ class IntrospectablePass(object):
continue
if s.name.replace('-', '_') == prop.name.replace('-', '_'):
self._property_warning(obj, prop, "Properties cannot have the same name as signals")
+ prop.introspectable = False
return False
def _property_method_collision(self, obj, prop):
@@ -280,6 +281,7 @@ class IntrospectablePass(object):
continue
if m.name == prop.name.replace('-', '_'):
self._property_warning(obj, prop, "Properties cannot have the same name as methods")
+ prop.introspectable = False
return False
def _property_vfunc_collision(self, obj, prop):
@@ -288,6 +290,7 @@ class IntrospectablePass(object):
continue
if vfunc.name == prop.name.replace('-', '_'):
self._property_warning(obj, prop, "Properties cannot have the same name as virtual methods")
+ prop.introspectable = False
return False
def _introspectable_symbol_collisions(self, obj, stack):
diff --git a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj-name-conflict.page b/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj-name-conflict.page
deleted file mode 100644
index 165ea2fe..00000000
--- a/tests/scanner/Regress-1.0-Gjs-expected/Regress.TestObj-name-conflict.page
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-<page id="Regress.TestObj-name-conflict"
- type="topic"
- style="property"
- xmlns="http://projectmallard.org/1.0/"
- xmlns:api="http://projectmallard.org/experimental/api/"
- xmlns:ui="http://projectmallard.org/1.0/ui/">
- <info>
- <link xref="Regress.TestObj" group="property" type="guide"/>
- <title type="link" role="topic">name-conflict</title>
- </info>
- <title>Regress.TestObj.name_conflict</title>
- <synopsis><code mime="text/x-gjs">
-TestObj.name_conflict: Number(gint) (Read / Write / Construct)
- </code></synopsis>
-
-
-</page>
diff --git a/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj-name-conflict.page b/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj-name-conflict.page
deleted file mode 100644
index 6d02a57c..00000000
--- a/tests/scanner/Regress-1.0-Python-expected/Regress.TestObj-name-conflict.page
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-<page id="Regress.TestObj-name-conflict"
- type="topic"
- style="property"
- xmlns="http://projectmallard.org/1.0/"
- xmlns:api="http://projectmallard.org/experimental/api/"
- xmlns:ui="http://projectmallard.org/1.0/ui/">
- <info>
- <link xref="Regress.TestObj" group="property" type="guide"/>
- <title type="link" role="topic">name-conflict</title>
- </info>
- <title>Regress.TestObj:name-conflict</title>
- <synopsis><code mime="text/x-python">
-"name-conflict" int : Read / Write / Construct
- </code></synopsis>
-
-
-</page>
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index 65a6a83d..6603abb4 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -4786,6 +4786,7 @@ raise an error.</doc>
</type>
</property>
<property name="name-conflict"
+ introspectable="0"
writable="1"
construct="1"
transfer-ownership="none">