Change error messaging of @SkylarkCallable invocations to match @SkylarkSignature more closely. Also clarify the method representation in these error messages is for the attempted method *call*, not the actual method signature. RELNOTES: None. PiperOrigin-RevId: 189935148
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java b/src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java index 841a94a..566c9fe 100644 --- a/src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java +++ b/src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java
@@ -440,7 +440,7 @@ } else { errorMessage = String.format( - "%s, in method %s of '%s'", + "%s, in method call %s of '%s'", argumentListConversionResult.getError(), formatMethod(methodName, args, kwargs), EvalUtils.getDataTypeNameFromClass(objClass)); @@ -538,7 +538,8 @@ } else if (!type.contains(value)) { return ArgumentListConversionResult.fromError( String.format( - "Cannot convert parameter '%s' to type %s", param.name(), type.toString())); + "expected value of type '%s' for parameter '%s'", + type.toString(), param.name())); } i++; } else if (param.named() && keys.remove(param.name())) { @@ -547,7 +548,8 @@ if (!type.contains(value)) { return ArgumentListConversionResult.fromError( String.format( - "Cannot convert parameter '%s' to type %s", param.name(), type.toString())); + "expected value of type '%s' for parameter '%s'", + type.toString(), param.name())); } } else { // Use default value