on master help sign in
Add expected output test for variable shadowing.
commit7a3a4474f67ea28cee28d2f3a3ed1435b422c700 authorLaszlo Pandy <laszlo.pandy@prezi.com> dateFri 9 Oct 2015, 14:23 (11 years ago) parent24e16db
2 files changed+46
tests/test-files/good-expected-js/VariableShadowing.elm.js+28 tests/test-files/good/VariableShadowing.elm+18
tests/test-files/good-expected-js/VariableShadowing.elm.jsnew file+28
@@ -0,0 +1,28 @@
1+Elm.Main = Elm.Main || {};
2+Elm.Main.make = function (_elm) {
3+ "use strict";
4+ _elm.Main = _elm.Main || {};
5+ if (_elm.Main.values) return _elm.Main.values;
6+ var _U = Elm.Native.Utils.make(_elm);
7+ var _op = {};
8+ var toName = function (a) {
9+ var name = function () {
10+ var _p0 = a;
11+ if (_p0.ctor === "First") {
12+ return "True";
13+ } else {
14+ var a = _p0._0,b = _p0._1;
15+ return a;
16+ }
17+ }();
18+ return name;
19+ };
20+ var Second = F2(function (a,b) {
21+ return {ctor: "Second",_0: a,_1: b};
22+ });
23+ var First = {ctor: "First"};
24+ return _elm.Main.values = {_op: _op
25+ ,First: First
26+ ,Second: Second
27+ ,toName: toName};
28+};
tests/test-files/good/VariableShadowing.elmnew file+18
@@ -0,0 +1,18 @@
1+
2+{- From: https://github.com/elm-lang/elm-compiler/issues/1086 -}
3+
4+type AType
5+ = First
6+ | Second String String
7+
8+toName : AType -> String
9+toName a =
10+ let name =
11+ case a of
12+ First ->
13+ "True"
14+
15+ Second a b ->
16+ a
17+ in
18+ name