diff --git a/community/cypher/cypher-compiler-2.0/src/main/scala/org/neo4j/cypher/internal/compiler/v2_0/symbols/FloatType.scala b/community/cypher/cypher-compiler-2.0/src/main/scala/org/neo4j/cypher/internal/compiler/v2_0/symbols/FloatType.scala index c950858f054d..e3633c47c839 100644 --- a/community/cypher/cypher-compiler-2.0/src/main/scala/org/neo4j/cypher/internal/compiler/v2_0/symbols/FloatType.scala +++ b/community/cypher/cypher-compiler-2.0/src/main/scala/org/neo4j/cypher/internal/compiler/v2_0/symbols/FloatType.scala @@ -22,7 +22,6 @@ package org.neo4j.cypher.internal.compiler.v2_0.symbols object FloatType { val instance = new FloatType() { val parentType = CTNumber - override lazy val coercibleTo: Set[CypherType] = Set(CTBoolean) override val toString = "Float" } } diff --git a/community/cypher/cypher-compiler-2.0/src/main/scala/org/neo4j/cypher/internal/compiler/v2_0/symbols/IntegerType.scala b/community/cypher/cypher-compiler-2.0/src/main/scala/org/neo4j/cypher/internal/compiler/v2_0/symbols/IntegerType.scala index 8359d3bcb495..04832a9a21da 100644 --- a/community/cypher/cypher-compiler-2.0/src/main/scala/org/neo4j/cypher/internal/compiler/v2_0/symbols/IntegerType.scala +++ b/community/cypher/cypher-compiler-2.0/src/main/scala/org/neo4j/cypher/internal/compiler/v2_0/symbols/IntegerType.scala @@ -22,7 +22,7 @@ package org.neo4j.cypher.internal.compiler.v2_0.symbols object IntegerType { val instance = new IntegerType() { val parentType = CTNumber - override lazy val coercibleTo: Set[CypherType] = Set(CTBoolean, CTFloat) + override lazy val coercibleTo: Set[CypherType] = Set(CTFloat) override val toString = "Integer" } } diff --git a/community/cypher/cypher-compiler-2.0/src/test/scala/org/neo4j/cypher/internal/compiler/v2_0/ast/AndTest.scala b/community/cypher/cypher-compiler-2.0/src/test/scala/org/neo4j/cypher/internal/compiler/v2_0/ast/AndTest.scala index 8aaf3102bdfd..b37ffb0cdec9 100644 --- a/community/cypher/cypher-compiler-2.0/src/test/scala/org/neo4j/cypher/internal/compiler/v2_0/ast/AndTest.scala +++ b/community/cypher/cypher-compiler-2.0/src/test/scala/org/neo4j/cypher/internal/compiler/v2_0/ast/AndTest.scala @@ -32,8 +32,8 @@ class AndTest extends InfixExpressionTestBase(And(_, _)(DummyPosition(0))) { @Test def shouldCoerceArguments() { - testValidTypes(CTInteger, CTBoolean)(CTBoolean) - testValidTypes(CTBoolean, CTInteger)(CTBoolean) + testInvalidApplication(CTInteger, CTBoolean)("Type mismatch: expected Boolean but was Integer") + testInvalidApplication(CTBoolean, CTInteger)("Type mismatch: expected Boolean but was Integer") } @Test diff --git a/community/cypher/cypher-compiler-2.0/src/test/scala/org/neo4j/cypher/internal/compiler/v2_0/ast/OrTest.scala b/community/cypher/cypher-compiler-2.0/src/test/scala/org/neo4j/cypher/internal/compiler/v2_0/ast/OrTest.scala index c93fa6670da4..0a91182ba654 100644 --- a/community/cypher/cypher-compiler-2.0/src/test/scala/org/neo4j/cypher/internal/compiler/v2_0/ast/OrTest.scala +++ b/community/cypher/cypher-compiler-2.0/src/test/scala/org/neo4j/cypher/internal/compiler/v2_0/ast/OrTest.scala @@ -32,8 +32,8 @@ class OrTest extends InfixExpressionTestBase(Or(_, _)(DummyPosition(0))) { @Test def shouldCoerceArguments() { - testValidTypes(CTInteger, CTBoolean)(CTBoolean) - testValidTypes(CTBoolean, CTInteger)(CTBoolean) + testInvalidApplication(CTInteger, CTBoolean)("Type mismatch: expected Boolean but was Integer") + testInvalidApplication(CTBoolean, CTInteger)("Type mismatch: expected Boolean but was Integer") } @Test diff --git a/community/cypher/cypher-compiler-2.0/src/test/scala/org/neo4j/cypher/internal/compiler/v2_0/ast/XorTest.scala b/community/cypher/cypher-compiler-2.0/src/test/scala/org/neo4j/cypher/internal/compiler/v2_0/ast/XorTest.scala index 4f97e1aeb219..ce122f9b3987 100644 --- a/community/cypher/cypher-compiler-2.0/src/test/scala/org/neo4j/cypher/internal/compiler/v2_0/ast/XorTest.scala +++ b/community/cypher/cypher-compiler-2.0/src/test/scala/org/neo4j/cypher/internal/compiler/v2_0/ast/XorTest.scala @@ -32,8 +32,8 @@ class XorTest extends InfixExpressionTestBase(Xor(_, _)(DummyPosition(0))) { @Test def shouldCoerceArguments() { - testValidTypes(CTInteger, CTBoolean)(CTBoolean) - testValidTypes(CTBoolean, CTInteger)(CTBoolean) + testInvalidApplication(CTInteger, CTBoolean)("Type mismatch: expected Boolean but was Integer") + testInvalidApplication(CTBoolean, CTInteger)("Type mismatch: expected Boolean but was Integer") } @Test diff --git a/community/cypher/cypher-compiler-2.0/src/test/scala/org/neo4j/cypher/internal/compiler/v2_0/symbols/TypeSpecTest.scala b/community/cypher/cypher-compiler-2.0/src/test/scala/org/neo4j/cypher/internal/compiler/v2_0/symbols/TypeSpecTest.scala index a3e24c0f4ec7..9eb8e036f560 100644 --- a/community/cypher/cypher-compiler-2.0/src/test/scala/org/neo4j/cypher/internal/compiler/v2_0/symbols/TypeSpecTest.scala +++ b/community/cypher/cypher-compiler-2.0/src/test/scala/org/neo4j/cypher/internal/compiler/v2_0/symbols/TypeSpecTest.scala @@ -290,9 +290,8 @@ class TypeSpecTest extends CypherFunSuite { } test("should identify coercions") { - assertEquals(CTBoolean.invariant, CTFloat.covariant.coercions) - assertEquals(CTBoolean | CTFloat, CTInteger.covariant.coercions) - assertEquals(CTBoolean | CTFloat, (CTFloat | CTInteger).coercions) + assertEquals(CTFloat.invariant, CTInteger.covariant.coercions) + assertEquals(CTFloat.invariant, (CTFloat | CTInteger).coercions) assertEquals(CTBoolean.invariant, CTCollection(CTAny).covariant.coercions) assertEquals(CTBoolean.invariant, TypeSpec.exact(CTCollection(CTPath)).coercions) assertEquals(CTBoolean | CTFloat, TypeSpec.all.coercions) @@ -304,7 +303,7 @@ class TypeSpecTest extends CypherFunSuite { assertEquals(CTFloat.invariant, CTInteger intersectOrCoerce CTFloat) assertEquals(TypeSpec.none, CTNumber intersectOrCoerce CTFloat) assertEquals(CTBoolean.invariant, CTCollection(CTAny).covariant intersectOrCoerce CTBoolean) - assertEquals(CTBoolean.invariant, CTNumber.covariant intersectOrCoerce CTBoolean) + assertEquals(TypeSpec.none, CTNumber.covariant intersectOrCoerce CTBoolean) assertEquals(CTBoolean.invariant, CTCollection(CTAny).covariant intersectOrCoerce CTBoolean) assertEquals(TypeSpec.none, CTInteger intersectOrCoerce CTString) } @@ -314,7 +313,7 @@ class TypeSpecTest extends CypherFunSuite { assertEquals(CTFloat.invariant, CTInteger constrainOrCoerce CTFloat) assertEquals(TypeSpec.none, CTNumber constrainOrCoerce CTFloat) assertEquals(CTBoolean.invariant, CTCollection(CTAny).covariant constrainOrCoerce CTBoolean) - assertEquals(CTBoolean.invariant, CTNumber.covariant constrainOrCoerce CTBoolean) + assertEquals(TypeSpec.none, CTNumber.covariant constrainOrCoerce CTBoolean) assertEquals(CTBoolean.invariant, CTCollection(CTAny).covariant constrainOrCoerce CTBoolean) assertEquals(TypeSpec.none, CTInteger constrainOrCoerce CTString) }