K2: scope functions still called rather than inlined (follow-up to #88)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 28/100
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 { … })), awhenarm'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@labelto the literal inside a loop, awhenor 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
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di CodeLaser/maddi
-
build/ci good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
bug front-end:javac
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
-
C# printer: an inner class of a generic class needs the outer type's arguments (Outer<A>.Inner)Apertafront-end:csharp
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 10/100
-
Java → C# translation: an idiomatic C# printer driven by the modification and nullability analysesApertaenhancement extension front-end:csharp
Difficoltà 5/5 Più di una settimana Idoneità per principianti 8/100
Tutte le issue di CodeLaser/maddi
Issue simili
-
[Bug] Lock owned by another client (e.g. Text app) cannot be unlocked from the appForse già presa @falkloewert l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
oracle/graalvm-reachability-metadata#11026 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
checkstyle/checkstyle#22050 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement Improvement
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
zowe/zowe-client-java-sdk#647 ·
-
RRX SAX: </rdf:RDF> inside rdf:parseType="Literal" ends the document ("Inconsistent parserMode:TOP")Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
apache/jena#4334 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno