Skip to content

Expression toString" suffix" should trigger a warning #13182

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 +.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions