diff --git a/packages/schema/src/language-server/validator/expression-validator.ts b/packages/schema/src/language-server/validator/expression-validator.ts index d5a11c7b7..06083e9e4 100644 --- a/packages/schema/src/language-server/validator/expression-validator.ts +++ b/packages/schema/src/language-server/validator/expression-validator.ts @@ -59,10 +59,6 @@ export default class ExpressionValidator implements AstValidator { } } - if (expr.$resolvedType?.decl === 'Unsupported') { - accept('error', 'Field of "Unsupported" type cannot be used in expressions', { node: expr }); - } - // extra validations by expression type switch (expr.$type) { case 'BinaryExpr': diff --git a/packages/schema/tests/schema/validation/datamodel-validation.test.ts b/packages/schema/tests/schema/validation/datamodel-validation.test.ts index d89e96a44..fd4274eab 100644 --- a/packages/schema/tests/schema/validation/datamodel-validation.test.ts +++ b/packages/schema/tests/schema/validation/datamodel-validation.test.ts @@ -75,7 +75,7 @@ describe('Data Model Validation Tests', () => { @@allow('all', a == 'a') } `) - ).toMatchObject(errorLike('Field of "Unsupported" type cannot be used in expressions')); + ).toMatchObject(errorLike('incompatible operand types')); }); it('Using `this` in collection predicate', async () => { diff --git a/tests/regression/tests/issue-1870.test.ts b/tests/regression/tests/issue-1870.test.ts new file mode 100644 index 000000000..aa392e54a --- /dev/null +++ b/tests/regression/tests/issue-1870.test.ts @@ -0,0 +1,15 @@ +import { loadModel, loadSchema } from '@zenstackhq/testtools'; + +describe('issue 1870', () => { + it('regression', async () => { + await loadModel( + ` + model Polygon { + id Int @id @default(autoincrement()) + geometry Unsupported("geometry(MultiPolygon, 4326)") + @@index([geometry], name: "parcel_polygon_idx", type: Gist) + } + ` + ); + }); +});