Aladdin - Scala Bugtracking
[#366] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Matthias Burak fixed 2004-09-29 10:06:01.0
subject Type of expressions embedded in XML literals
code
object T {
  val x = <a> { 1 } </a>;
}
what happened
The compiler complains:
T.scala:2: overloaded method + of type (scala.xml.Node)scala.xml.NodeBuffer
<and> (scala.Iterable[scala.xml.Node])scala.xml.NodeBuffer
<and> (java.lang.String)scala.xml.NodeBuffer cannot be applied to
(scala.Int) with expected result type scala.Seq[scala.xml.Node]
  val x = <a> { 1 } </a>;
                ^
one error found
what expected It should either be specified in the spec that the type of expressions embedded in XML literals has to be a string, or the compiler should accept the code.
[back to overview]
Changes of this bug report
Matthias  edited on  2004-09-29 10:07:15.0
Burak  edited on  2004-12-16 15:14:24.0
The compiler accepts the code now. Actually only the library function for appending nodes to a NodeBuffer is changed. Writing any value that is not a node leads to an implicit toString() conversion.
Burak  edited on  2004-12-16 15:14:51.0