Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

K2: scope functions still called rather than inlined (follow-up to #88)

Aperta
#98 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
28/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java, kotlin
Ambito
compilers

Direzione di ricerca

This is a follow-up to #88 on inlining Kotlin scope functions (apply/also/let/run/with/use) in the K2-related analysis. Read that issue and the listed remaining cases: lambdas in conditionals or argument position, function values instead of literals, labelled returns, and destructured parameters. Generalise value-to-statement lowering so inlining does not change evaluation order. Done when those sites are inlined and receiver mutations inside the body are visible on the receiver, matching the census intent.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

After #88 (stages 1–3 and the control-flow elvis, local commits 154d99b83…429446994), apply/also/let/run/with/use are inlined wherever they sit on a statement's unconditionally evaluated spine, as a statement, or on the left of a control-flow elvis. What still stays a call, measured by a scratch census over the detekt and coil parses (site visits, some counted twice, so read these as relative sizes):

  • A literal lambda in a conditional or argument position (~96 on detekt, ~20 on coil): the arm of a null-safe conditional (a ?: b.also { … }, c?.x?.run { … } inside a larger expression), an argument (f(x.let { … })), a when arm's value. Inlining one moves an evaluation unless the enclosing expression is itself lowered to statements, so it needs the value-to-statement lowering generalised.
  • A function value instead of a literal (~46 on detekt, ~11 on coil): x?.let(this::extractRuleDocumentation), let(nonNullChecks::add), let(::RealEditor), apply(builder). Inlined, this is a direct call on the bound receiver (r.m(x), new C(x), f.invoke(x)).
  • A return@label to the literal inside a loop, a when or a nested lambda (0 on the three corpora): kept deliberately, since the analysis cannot merge a jump out of a block (see #88 stage 2).
  • A destructured lambda parameter.

Each still-called site loses exactly what #88 was about: a modification of the receiver inside the body is not carried back to it.

Lingua principale
Java
Stelle
1
Fork
1
Merge medio
1h 58m
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di CodeLaser/maddi

Tutte le issue di CodeLaser/maddi

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.