Skip to content

Expression toString" suffix" should trigger a warning #13182

@noresttherein

Description

@noresttherein

Scala version: 2.13.16

#Reproduction

	class IntBox(val x :Int) {
		def plus(other :IntBox) :String = toString" + " + other.x
		override def toString = x.toString
	}
	println(new IntBox(2).plus(new IntBox(2)))

#Problem

StringContext(ArraySeq( + ))2

This is almost certainly not what the programmer wanted. I propose it triggers a compiler warning about a missing +.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions