on master help sign in
Add some more explanation to @laszlopandy's addition from #1086
05a0c16Evan Czaplicki
tests/test-files/good/CodeGenBugs/Shadowing.elm+13−9
@@ -1,18 +1,22 @@
1+-- From: https://github.com/elm-lang/elm-compiler/issues/1086
2+--
3+-- Problem is that the `a` in (Second a b) shadowed the argument to `toName`,
4+-- actually overwriting the value.
1
5
2−{- From: https://github.com/elm-lang/elm-compiler/issues/1086 -}
3
6
4type AType
7type AType
5 = First
8 = First
6 | Second String String
9 | Second String String
7
10
11+
8toName : AType -> String
12toName : AType -> String
9toName a =
13toName a =
10− let name =
14+ let name =
11− case a of
15+ case a of
12− First ->
16+ First ->
13− "True"
17+ "True"
14
18
15− Second a b ->
19+ Second a b ->
16− a
20+ a
17− in
21+ in
18− name
22+ name