Skip to content

-Ywarn-adapted-args doesn't detect monomorphic call #6923

@scabug

Description

@scabug
% scala210 -Ywarn-adapted-args -Xfatal-warnings -e 'def foo(a: Any) = a; foo(1, 2)'
# Warning expected here.

% scala210 -Ywarn-adapted-args -Xfatal-warnings -e 'def foo[A](a: Any) = a; foo(1, 2)'
/var/folders/xq/4pqxykpn5n56mngmch4p5xgw0000gn/T/scalacmd4298701803865603272.scala:1: error: Adapting argument list by creating a 2-tuple: this may not be what you want.
        signature: $anon.foo[A](a: Any): Any
  given arguments: 1, 2
 after adaptation: $anon.foo((1, 2): (Int, Int))
def foo[A](a: Any) = a; foo(1, 2)
                           ^
one error found

% scala210 -Yno-adapted-args  -e 'def foo[A](a: Any) = a; foo(1, 2)'
/var/folders/xq/4pqxykpn5n56mngmch4p5xgw0000gn/T/scalacmd5030784570605432719.scala:1: warning: No automatic adaptation here: use explicit parentheses.
        signature: $anon.foo[A](a: Any): Any
  given arguments: 1, 2
 after adaptation: $anon.foo((1, 2): (Int, Int))
def foo[A](a: Any) = a; foo(1, 2)
                           ^
/var/folders/xq/4pqxykpn5n56mngmch4p5xgw0000gn/T/scalacmd5030784570605432719.scala:1: error: too many arguments for method foo: (a: Any)Any
def foo[A](a: Any) = a; foo(1, 2)
                           ^
one warning found
one error found

% scala210 -Yno-adapted-args  -e 'def foo(a: Any) = a; foo(1, 2)'
/var/folders/xq/4pqxykpn5n56mngmch4p5xgw0000gn/T/scalacmd8192043649954446982.scala:1: error: too many arguments for method foo: (a: Any)Any
def foo(a: Any) = a; foo(1, 2)
                        ^
one error found

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions