Skip to content

Obscure error message involves default arg #23557

@som-snytt

Description

@som-snytt

Compiler version

3.7

Minimized code

//> using scala 3.7.0
//> using options -Wall -Werror

class C[A](x: A = 42)

@main def Test = println:
  new C[String]()

Output

-- [E007] Type Mismatch Error: ...
5 |  new C[String]()
  |      ^^^^^^^^^
  |      Found:    Int
  |      Required: String
  |
  | longer explanation available when compiling with `-explain`
1 error found

Expectation

An indicator of where the error is.

Scala 2:

 found   : 42
 required: String
Error occurred in an application involving default arguments.
  new C[String]()
  ^
1 error

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:reportingError reporting including formatting, implicit suggestions, etcbetter-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesitype:bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions