Inspectopedia 2026.3 Help

Replace 'with' with 'context'

Reports with function calls whose receiver is used only as a context argument inside the lambda.

When the receiver passed to with is never accessed as an implicit receiver (for example, via member calls or this) but only propagated as a context argument to functions declaring context parameters, the with call can be replaced with a context call. This makes the intent explicit and better reflects how the value is actually consumed.

The quick-fix replaces the with callee with context.

Example:

interface UserService { fun log(message: String) } context(service: UserService) fun logStart() { service.log("start") } fun run(service: UserService) { with(service) { logStart() } }
fun run(service: UserService) { context(service) { logStart() } }

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

ReplaceWithCallWithContextCall
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Kotlin | Style issues

This inspection requires the ContextParameters language feature to be enabled.

Inspection ID: ReplaceWithCallWithContextCall

Suppressing Inspection

You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:

//noinspection ReplaceWithCallWithContextCall

More detailed instructions as well as other ways and options that you have can be found in the product documentation:

Inspection Details

By default bundled with:

IntelliJ IDEA 2026.3, Qodana for JVM 2026.3,

Last modified: 20 November 2026