Kotlin: unify enum library-test query across suites

The `enum` library test used two different queries in test-kotlin1 and
test-kotlin2, so their `.expected` files were not comparable (78 divergent lines
that reflected the query difference, not an extractor difference):

  * test-kotlin1: `from Method m, RefType t where t = m.getDeclaringType() and
    t.getName() = ["Enum", "Enum<?>", "Enum<E>", "EnumUserKt"]
    select t.getQualifiedName(), t.getName(), m.getName()`
  * test-kotlin2: `from Method m where m.getDeclaringType().getName().matches("Enum%")
    select m.getName()`

The K1 query is the more precise of the two: it pins the declaring types by exact
name and reports the qualified name alongside the method, whereas the K2
`matches("Enum%")` form also pulls in unrelated `java.util.EnumSet` members as
noise. We adopt the K1 query in both suites (a pure test-input synchronisation,
no extractor change).

After unification the two suites' output is identical except for a single row:
test-kotlin2 additionally reports `kotlin.Enum | Enum | finalize`. That is a
compiler-builtin difference (the Kotlin `kotlin.Enum` built-in class exposes
`finalize` under the 2.4.0/K2 frontend but not under the 2.3.20/K1 frontend); it
is a compiler-version artifact of the built-in class member set, not something the
extractor synthesises, so it is tracked separately rather than papered over here.

All 3333 tests pass in both suites; test-kotlin1 is unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Anders Fugmann
2026-07-13 21:35:04 +02:00
parent d91b3899ae
commit dc8b6f99ac
2 changed files with 49 additions and 38 deletions

View File

@@ -1,39 +1,48 @@
#select
| addAll |
| addRange |
| allOf |
| asIterator |
| clone |
| compareTo |
| complement |
| complementOf |
| copyOf |
| describeConstable |
| equals |
| finalize |
| forEach |
| getDeclaringClass |
| getFirst |
| getLast |
| hasMoreElements |
| hashCode |
| name |
| nextElement |
| noneOf |
| of |
| ordinal |
| parallelStream |
| range |
| resolveConstantDesc |
| reversed |
| spliterator |
| stream |
| toArray |
| toString |
| typeCheck |
| usesEnum |
| valueOf |
| writeReplace |
| EnumUserKt | EnumUserKt | usesEnum |
| java.lang.Enum | Enum | clone |
| java.lang.Enum | Enum | compareTo |
| java.lang.Enum | Enum | describeConstable |
| java.lang.Enum | Enum | equals |
| java.lang.Enum | Enum | finalize |
| java.lang.Enum | Enum | getDeclaringClass |
| java.lang.Enum | Enum | hashCode |
| java.lang.Enum | Enum | name |
| java.lang.Enum | Enum | ordinal |
| java.lang.Enum | Enum | toString |
| java.lang.Enum | Enum | valueOf |
| java.lang.Enum<?> | Enum<?> | clone |
| java.lang.Enum<?> | Enum<?> | compareTo |
| java.lang.Enum<?> | Enum<?> | describeConstable |
| java.lang.Enum<?> | Enum<?> | equals |
| java.lang.Enum<?> | Enum<?> | finalize |
| java.lang.Enum<?> | Enum<?> | getDeclaringClass |
| java.lang.Enum<?> | Enum<?> | hashCode |
| java.lang.Enum<?> | Enum<?> | name |
| java.lang.Enum<?> | Enum<?> | ordinal |
| java.lang.Enum<?> | Enum<?> | toString |
| java.lang.Enum<?> | Enum<?> | valueOf |
| java.lang.Enum<E> | Enum<E> | clone |
| java.lang.Enum<E> | Enum<E> | compareTo |
| java.lang.Enum<E> | Enum<E> | describeConstable |
| java.lang.Enum<E> | Enum<E> | equals |
| java.lang.Enum<E> | Enum<E> | finalize |
| java.lang.Enum<E> | Enum<E> | getDeclaringClass |
| java.lang.Enum<E> | Enum<E> | hashCode |
| java.lang.Enum<E> | Enum<E> | name |
| java.lang.Enum<E> | Enum<E> | ordinal |
| java.lang.Enum<E> | Enum<E> | toString |
| java.lang.Enum<E> | Enum<E> | valueOf |
| kotlin.Enum | Enum | clone |
| kotlin.Enum | Enum | compareTo |
| kotlin.Enum | Enum | describeConstable |
| kotlin.Enum | Enum | equals |
| kotlin.Enum | Enum | finalize |
| kotlin.Enum | Enum | getDeclaringClass |
| kotlin.Enum | Enum | hashCode |
| kotlin.Enum | Enum | name |
| kotlin.Enum | Enum | ordinal |
| kotlin.Enum | Enum | toString |
enumConstants
| enumUser.kt:3:16:3:17 | A |
| enumUser.kt:3:19:3:20 | B |

View File

@@ -1,7 +1,9 @@
import java
from Method m
where m.getDeclaringType().getName().matches("Enum%")
select m.getName()
from Method m, RefType t
where
t = m.getDeclaringType() and
t.getName() = ["Enum", "Enum<?>", "Enum<E>", "EnumUserKt"]
select t.getQualifiedName(), t.getName(), m.getName()
query predicate enumConstants(EnumConstant ec) { ec.fromSource() }