@@ -2802,6 +2802,57 @@ public void isAlwaysTrue_boolFunction_verified() throws Exception {
28022802 assertThat (result .status ()).isEqualTo (VerificationStatus .VERIFIED );
28032803 }
28042804
2805+ // Each pair of calls looks alike but may have different implementations, so equating them would
2806+ // be a false VERIFIED. Any counterexample depends on the values the functions return.
2807+ @ Test
2808+ public void isAlwaysTrue_distinctFunctionSymbols_inconclusive (
2809+ @ TestParameter ({
2810+ // Member and global overloads of the same name.
2811+ "fx(role, country) == role.fx(country)" ,
2812+ // Overloads whose argument values coincide (empty lists of different element types).
2813+ "size(int_list) == 0 && size(string_list) == 0 ? f(int_list) == f(string_list) : true"
2814+ })
2815+ String expression )
2816+ throws Exception {
2817+ CelCompiler celCompiler =
2818+ CEL .toCompilerBuilder ()
2819+ .addVar ("string_list" , ListType .create (SimpleType .STRING ))
2820+ .addFunctionDeclarations (
2821+ CelFunctionDecl .newFunctionDeclaration (
2822+ "fx" ,
2823+ CelOverloadDecl .newGlobalOverload (
2824+ "fx_global" , SimpleType .BOOL , SimpleType .STRING , SimpleType .STRING ),
2825+ CelOverloadDecl .newMemberOverload (
2826+ "fx_member" , SimpleType .BOOL , SimpleType .STRING , SimpleType .STRING )),
2827+ CelFunctionDecl .newFunctionDeclaration (
2828+ "f" ,
2829+ CelOverloadDecl .newGlobalOverload (
2830+ "f_list_int" , SimpleType .INT , ListType .create (SimpleType .INT )),
2831+ CelOverloadDecl .newGlobalOverload (
2832+ "f_list_string" , SimpleType .INT , ListType .create (SimpleType .STRING ))))
2833+ .build ();
2834+ CelAbstractSyntaxTree ast = celCompiler .compile (expression ).getAst ();
2835+ CelVerificationResult result = VERIFIER .isAlwaysTrue (ast );
2836+
2837+ assertThat (result .status ()).isEqualTo (VerificationStatus .INCONCLUSIVE );
2838+ }
2839+
2840+ @ Test
2841+ public void isAlwaysTrue_zeroArityFunctionAndSameNamedVariable_inconclusive () throws Exception {
2842+ CelCompiler celCompiler =
2843+ CEL .toCompilerBuilder ()
2844+ .addVar ("g" , SimpleType .INT )
2845+ .addFunctionDeclarations (
2846+ CelFunctionDecl .newFunctionDeclaration (
2847+ "g" , CelOverloadDecl .newGlobalOverload ("g_zero" , SimpleType .INT )))
2848+ .build ();
2849+ CelAbstractSyntaxTree ast = celCompiler .compile ("g() == g" ).getAst ();
2850+
2851+ CelVerificationResult result = VERIFIER .isAlwaysTrue (ast );
2852+
2853+ assertThat (result .status ()).isEqualTo (VerificationStatus .INCONCLUSIVE );
2854+ }
2855+
28052856 @ Test
28062857 public void verifyEquivalence_identicalFunctionCalls_equivalent () throws Exception {
28072858 // Identical calls to an uninterpreted function always produce identical results.
0 commit comments