Skip to content

"Incompatible combinations of tabs and spaces in indentation prefixes." significant indentation is enforced in a literal #14386

Closed
@eed3si9n

Description

@eed3si9n

Compiler version

3.1.1

Minimized code

package example

def logLevelDetail(level: Int): String =
  s"""$level

// the following line is indented using [tab][tab]
		Sets the global logging level to $level.
"""

Output

sbt:hello> compile
[info] compiling 1 Scala source to /private/tmp/hello/target/scala-3.1.1/classes ...
[error] -- Error: /private/tmp/hello/src/main/scala/example/Hello.scala:7:34 -----------
[error] 7 |		Sets the global logging level to $level.
[error]   |		                                  ^
[error]   |     Incompatible combinations of tabs and spaces in indentation prefixes.
[error]   |     Previous indent : 2 spaces
[error]   |     Latest indent   : 2 tabs
[error] -- Error: /private/tmp/hello/src/main/scala/example/Hello.scala:7:39 -----------
[error] 7 |		Sets the global logging level to $level.
[error]   |		                                       ^
[error]   |     Incompatible combinations of tabs and spaces in indentation prefixes.
[error]   |     Previous indent : 2 spaces
[error]   |     Latest indent   : 2 tabs
[error] two errors found
[error] two errors found

Expectation

It compiles. Indentation rules should not apply to lines within multiline string literals.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions