From 6ba247cc2734ce262f1e23e4d096f753fb266797 Mon Sep 17 00:00:00 2001 From: slisson Date: Sun, 8 Dec 2024 13:13:55 +0100 Subject: [PATCH] fix(modelql)!: disable implicit queries to avoid accidental performance issues You should fix the unintended implicit queries or use .query explicitly. You can also set the environment variable MODELQL_IMPLICIT_QUERIES_ENABLED=true to re-enable this feature. --- .../kotlin/org/modelix/modelql/typed/TypedModelQLTest.kt | 9 +++++---- .../kotlin/org/modelix/modelql/client/ModelQLNode.js.kt | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/model-api-gen-gradle-test/kotlin-generation/src/test/kotlin/org/modelix/modelql/typed/TypedModelQLTest.kt b/model-api-gen-gradle-test/kotlin-generation/src/test/kotlin/org/modelix/modelql/typed/TypedModelQLTest.kt index 194b28a3d7..396d9c4572 100644 --- a/model-api-gen-gradle-test/kotlin-generation/src/test/kotlin/org/modelix/modelql/typed/TypedModelQLTest.kt +++ b/model-api-gen-gradle-test/kotlin-generation/src/test/kotlin/org/modelix/modelql/typed/TypedModelQLTest.kt @@ -227,7 +227,7 @@ class TypedModelQLTest { .untyped() .toList() }.map { it.typed() } - assertEquals("plus", result[0].name) + assertEquals("plus", result[0].query { it.name }) } @Test @@ -239,7 +239,7 @@ class TypedModelQLTest { .filter { it.visibility.instanceOf(C_PublicVisibility) } .toList() } - assertEquals("plus", result[0].name) + assertEquals("plus", result[0].query { it.name }) } @Test @@ -257,8 +257,9 @@ class TypedModelQLTest { .member .ofConcept(C_StaticMethodDeclaration) .first() + .name } - assertEquals(expected, actual.name) + assertEquals(expected, actual) } @Test @@ -297,7 +298,7 @@ class TypedModelQLTest { .first() } assertNotEquals(expected, oldValue) - assertEquals(expected, actual.variableDeclaration.name) + assertEquals(expected, actual.query { it.variableDeclaration.name }) } @Test diff --git a/modelql-client/src/jsMain/kotlin/org/modelix/modelql/client/ModelQLNode.js.kt b/modelql-client/src/jsMain/kotlin/org/modelix/modelql/client/ModelQLNode.js.kt index e0686896d3..5186b0f6aa 100644 --- a/modelql-client/src/jsMain/kotlin/org/modelix/modelql/client/ModelQLNode.js.kt +++ b/modelql-client/src/jsMain/kotlin/org/modelix/modelql/client/ModelQLNode.js.kt @@ -17,4 +17,4 @@ package org.modelix.modelql.client actual val implicitQueriesEnabled: Boolean - get() = false \ No newline at end of file + get() = false