parse.y (java_complete_lhs): Only allow compound assignment of reference type if type is String.

* parse.y (java_complete_lhs): Only allow compound assignment of
	reference type if type is String.

Co-Authored-By: Alexandre Petit-Bianco <apbianco@cygnus.com>

From-SVN: r38236
This commit is contained in:
Tom Tromey 2000-12-13 22:36:24 +00:00 committed by Tom Tromey
parent 47bf5e3a33
commit 568aac9cf7
2 changed files with 14 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2000-11-20 Tom Tromey <tromey@cygnus.com>
Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (java_complete_lhs): Only allow compound assignment of
reference type if type is String.
2000-12-09 Alexandre Petit-Bianco <apbianco@cygnus.com>
* Make-lang.in (java/jcf-path.o:): libgcj.jar replaces libgcj.zip.

View file

@ -11608,6 +11608,14 @@ java_complete_lhs (node)
nn = java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2),
TREE_TYPE (lvalue), nn));
/* If the assignment is compound and has reference type,
then ensure the LHS has type String and nothing else. */
if (JREFERENCE_TYPE_P (TREE_TYPE (lvalue))
&& ! JSTRING_TYPE_P (TREE_TYPE (lvalue)))
parse_error_context (wfl_op2,
"Incompatible type for `+='. Can't convert `%s' to `java.lang.String'",
lang_printable_name (TREE_TYPE (lvalue), 0));
/* 15.25.2.b: Left hand is an array access. FIXME */
}