Skip to content

Argument for implicit parameter sender was supplied using a default argument: 3.3.7-RC1 #23842

@He-Pin

Description

@He-Pin

Compiler version

3.3.7-RC1

Minimized code

https://github.com/apache/pekko/actions/runs/17338073097/job/49227565939?pr=2104

  final def scheduleOnce(delay: FiniteDuration, receiver: ActorRef, message: Any)(
      implicit
      executor: ExecutionContext,
      sender: ActorRef = Actor.noSender): Cancellable

Output

[error] -- [E220] Type Error: /home/runner/work/pekko/pekko/actor-tests/src/test/scala/org/apache/pekko/actor/SupervisorHierarchySpec.scala:242:70 
[error] 242 |        context.system.scheduler.scheduleOnce(1.second, self, Dump(0))(context.dispatcher)
[error]     |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]     |Argument for implicit parameter sender was supplied using a default argument.
[error]     |
[error]     | longer explanation available when compiling with `-explain`

Expectation

Compiles ok
refs: #23559

The implicit ActorRef is from the Actor where:

  /**
   * The 'self' field holds the ActorRef for this actor.
   * <p/>
   * Can be used to send messages to itself:
   * <pre>
   * self ! message
   * </pre>
   */
  implicit final val self: ActorRef = context.self // MUST BE A VAL, TRUST ME

And then, when using the method inside the Actor, this will cause an error. I think the value should be bound to self and no warning.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions