Skip to content

Generate nicer binding for records and lists arguments#2

Merged
mdgriffith merged 1 commit into
mdgriffith:mainfrom
miniBill:main
Nov 3, 2021
Merged

Generate nicer binding for records and lists arguments#2
mdgriffith merged 1 commit into
mdgriffith:mainfrom
miniBill:main

Conversation

@miniBill
Copy link
Copy Markdown
Contributor

@miniBill miniBill commented Nov 3, 2021

Generate bindings for records and lists arguments that actually take those records and lists in

@mdgriffith mdgriffith merged commit d0836f1 into mdgriffith:main Nov 3, 2021
dillonkearns added a commit to dillonkearns/elm-codegen that referenced this pull request Mar 31, 2026
…ors.

Found 1 new bug (finding mdgriffith#6):
- Elm.Arg.aliasAs generates fresh type variable for the alias instead
  of the actual record type from the underlying pattern.

Coverage improvements:
  TOTAL: 57.4% -> 60.9%
  Elm.Declare: 33.7% -> 54.2% (+20.5%)
  Elm.Arg: 55.6% -> 77.8% (+22.2%)
  Internal.Arg: 57.4% -> 69.8% (+12.4%)
  Internal.Write: 66.1% -> 71.0%

6 bugs total found by property testing:
  mdgriffith#1 Number type variable collision (FIXED)
  mdgriffith#2 Pipe + lambda parens (FIXED)
  mdgriffith#3 Operator multi-line indentation
  mdgriffith#4 Comparable type variable leak
  mdgriffith#5 functionReduced wrong type annotations
  mdgriffith#6 aliasAs wrong type for alias variable

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
dillonkearns added a commit to dillonkearns/elm-codegen that referenced this pull request Mar 31, 2026
Found 2 more bugs:
- Finding mdgriffith#5 update: Elm.unwrapper also generates wrong type
  annotations (val -> unwrapped instead of Wrapper -> Int)
- Finding mdgriffith#7: Elm.Op.pipeLeft with lambda absorbs <| into
  lambda body (\x -> x <| "hello" instead of (\x -> x) <| "hello")

Coverage: 60.9% -> 62.5%
  Elm: 60.5% -> 64.6%
  Elm.Declare: 54.2% -> 63.9% (+9.7%)
  Elm.Op: 75.6% -> 80.5%

Total bugs found: 7
  mdgriffith#1 Number type variable collision (FIXED)
  mdgriffith#2 Pipe + lambda parens (FIXED)
  mdgriffith#3 Operator multi-line indentation
  mdgriffith#4 Comparable type variable leak
  mdgriffith#5 functionReduced/unwrapper wrong type annotations
  mdgriffith#6 aliasAs wrong type for alias variable
  mdgriffith#7 pipeLeft lambda not parenthesized

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
dillonkearns added a commit to dillonkearns/elm-codegen that referenced this pull request Mar 31, 2026
Found 1 new class of bugs (finding mdgriffith#8):
- 19 missing type annotations across 6 different API patterns
  (Let.unpack, Let.fn, unwrap, Declare.value, Elm.get through alias)
- elm-codegen's type inference silently fails for these patterns,
  producing declarations without type annotations

Coverage: 62.5% -> 63.2%

Total bugs found: 8
  mdgriffith#1 Number type variable collision (FIXED)
  mdgriffith#2 Pipe + lambda parens (FIXED)
  mdgriffith#3 Operator multi-line indentation
  mdgriffith#4 Comparable type variable leak
  mdgriffith#5 functionReduced/unwrapper wrong type annotations
  mdgriffith#6 aliasAs wrong type for alias variable
  mdgriffith#7 pipeLeft lambda not parenthesized
  mdgriffith#8 Missing type annotations for multiple APIs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
dillonkearns added a commit to dillonkearns/elm-codegen that referenced this pull request Mar 31, 2026
…ators.

Confirmed that Elm.Op.pipeTo hits the same lambda parens bug as
finding mdgriffith#2/mdgriffith#7 (internally calls functionReduced).

Extensible record annotations (Type.extensible) generate correctly —
`{ a | name : String }` works for both aliases and function args.

List pattern matching (Elm.Arg.list, items, listRemaining) generates
correct code with proper head :: tail and [first, second] patterns.

Note: elm-pages --coverage stopped working after recent changes
(Coverage.track not found in compiled output). Filed as DX bug.

Coverage at last measurement: 63.2% total.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants