Ticket #9 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

Unpacked fields with free variables in their types don't work

Reported by: SamB Owned by:
Priority: major Milestone:
Component: frontend Version:
Keywords: Cc:
Test Case: UnpackedPoly

Description (last modified by SamB) (diff)

The free variables are escaping!

% lhc -dhtml -ddatatable -de-verbose regress/tests/bugs/UnpackedPoly.hs
[Practically unreadable HTML edited out...]

Change History

Changed 6 years ago by SamB

Err, lets try that in plaintext ...

[86 of 86] Main
(#3#) :: * → * → * → #
      = Λx2.Λx4.Λx6. (# x2∷*, x4∷*, x6∷* #)
      slots: (*,*,*)
      alias: NotAlias
      virtual: Nothing
      inhabits: Lhc@.#
      children: DataNormal [(#3#)]
(#3#) :: ∀x2.∀x4.∀x6. (x2∷*) → (x4∷*) → (x6∷*) → (# x2∷*, x4∷*, x6∷* #)
      = λx22∷(x2∷*).λx24∷(x4∷*).λx26∷(x6∷*).
      (# x22∷(x2∷*), x24∷(x4∷*), x26∷(x6∷*) #)
      slots: (x2∷*,x4∷*,x6∷*)
      alias: NotAlias
      virtual: Nothing
      inhabits: (#3#)
      children: DataNone
Main.Bar :: ∀x2.Πx5∷Main.Foo (x2∷*). Main.Bar (x2∷*)
         = λx5∷Main.Foo (x2∷*).
         (case __∷Main.Foo (x2∷*) <- x5∷Main.Foo (x2∷*) of
             Main.Foo (x7∷[x2∷*]) → Main.Bar (x7∷[x2∷*]);)∷Main.Bar (x2∷*)
         slots: ([x2∷*])
         alias: NotAlias
         virtual: Nothing
         inhabits: Main.Bar
         children: DataNone
Main.Bar :: * → *
         = Λx2. Main.Bar (x2∷*)
         slots: (*)
         alias: NotAlias
         virtual: Nothing
         inhabits: Lhc@.*
         children: DataNormal [Main.Bar]
Main.Foo :: * → *
         = Λx2. Main.Foo (x2∷*)
         slots: (*)
         alias: NotAlias
         virtual: Nothing
         inhabits: Lhc@.*
         children: DataNormal [Main.Foo]
Main.Foo :: ∀x2.Πx5∷[x2∷*]. Main.Foo (x2∷*)
         = λx5∷[x2∷*]. Main.Foo (x5∷[x2∷*])
         slots: ([x2∷*])
         alias: NotAlias
         virtual: Nothing
         inhabits: Main.Foo
         children: DataNone
LintPostProcess
>>> Type Error
Instance@.iLhc.Show.showsPrec.Main.Bar = ΛMain.v51.λx4∷Int.
                                         λx6∷Main.Bar (Main.v51∷*).
    (case x6∷Main.Bar (Main.v51∷*) of
        Main.Bar (x10∷[x2∷*]) → let
            x8∷Main.Foo (Main.v51∷*) = Main.Foo (x10∷[x2∷*]);
            in let
                Main.11_aa∷Main.Foo (Main.v51∷*) = x8∷Main.Foo (Main.v51∷*);
                in let Main.10_d∷Int = x4∷Int; in let
                        x9∷Bool = (Lhc.Order.>=∷∀Lhc.Order.17_a.
                        (Lhc.Order.17_a∷*) → (Lhc.Order.17_a∷*) → Bool) Int (Main.10_d∷Int) (Int# 10);
                        in let
                            x11∷String → String = let
                                x256521830∷String → String =
                                (Lhc.Show.showString∷String → String → String) "Bar";
                                in let
                                    x243548158∷String → String = let
                                        x230574400∷String → String =
                                        (Lhc.Show.showChar∷Char → String → String) (Char# 32);
                                        in let
                                            x217600726∷String → String =
                                            (Lhc.Show.showsPrec∷∀Lhc.Show.2_a.
                                            Int → (Lhc.Show.2_a∷*) → String → String) (Main.Foo (Main.v51∷*)) (Int# 10) (Main.11_aa∷Main.Foo (Main.v51∷*));
                                            in (Lhc.Basics..∷∀Lhc.Basics.v304.
                                                             ∀Lhc.Basics.v305.
                                                             ∀Lhc.Basics.v306.
                                            ((Lhc.Basics.v305∷*) → (Lhc.Basics.v306∷*)) → ((Lhc.Basics.v304∷*) → (Lhc.Basics.v305∷*)) → (Lhc.Basics.v304∷*) → (Lhc.Basics.v306∷*)) String String String (x230574400∷String → String) (x217600726∷String → String);
                                    in (Lhc.Basics..∷∀Lhc.Basics.v304.
                                                     ∀Lhc.Basics.v305.
                                                     ∀Lhc.Basics.v306.
                                    ((Lhc.Basics.v305∷*) → (Lhc.Basics.v306∷*)) → ((Lhc.Basics.v304∷*) → (Lhc.Basics.v305∷*)) → (Lhc.Basics.v304∷*) → (Lhc.Basics.v306∷*)) String String String (x256521830∷String → String) (x243548158∷String → String);
                            in
                            (Lhc.Show.showParen∷Bool → (String → String) → String → String) (x9∷Bool) (x11∷String → String);
        _∷Main.Bar (Main.v51∷*) → <⊥:<unknown>:6:26: Unmatched pattern∷String → String>;)∷String → String

>>> internal error:
fullCheck(nested): λx4∷Int.λx6∷Main.Bar (Main.v51∷*).
(case x6∷Main.Bar (Main.v51∷*) of
    Main.Bar (x10∷[x2∷*]) → let
        x8∷Main.Foo (Main.v51∷*) = Main.Foo (x10∷[x2∷*]);
        in let Main.11_aa∷Main.Foo (Main.v51∷*) = x8∷Main.Foo (Main.v51∷*); in
            let Main.10_d∷Int = x4∷Int; in let
                    x9∷Bool = (Lhc.Order.>=∷∀Lhc.Order.17_a.
                    (Lhc.Order.17_a∷*) → (Lhc.Order.17_a∷*) → Bool) Int (Main.10_d∷Int) (Int# 10);
                    in let
                        x11∷String → String = let
                            x256521830∷String → String =
                            (Lhc.Show.showString∷String → String → String) "Bar";
                            in let
                                x243548158∷String → String = let
                                    x230574400∷String → String =
                                    (Lhc.Show.showChar∷Char → String → String) (Char# 32);
                                    in let
                                        x217600726∷String → String =
                                        (Lhc.Show.showsPrec∷∀Lhc.Show.2_a.
                                        Int → (Lhc.Show.2_a∷*) → String → String) (Main.Foo (Main.v51∷*)) (Int# 10) (Main.11_aa∷Main.Foo (Main.v51∷*));
                                        in (Lhc.Basics..∷∀Lhc.Basics.v304.
                                                         ∀Lhc.Basics.v305.
                                                         ∀Lhc.Basics.v306.
                                        ((Lhc.Basics.v305∷*) → (Lhc.Basics.v306∷*)) → ((Lhc.Basics.v304∷*) → (Lhc.Basics.v305∷*)) → (Lhc.Basics.v304∷*) → (Lhc.Basics.v306∷*)) String String String (x230574400∷String → String) (x217600726∷String → String);
                                in (Lhc.Basics..∷∀Lhc.Basics.v304.
                                                 ∀Lhc.Basics.v305.
                                                 ∀Lhc.Basics.v306.
                                ((Lhc.Basics.v305∷*) → (Lhc.Basics.v306∷*)) → ((Lhc.Basics.v304∷*) → (Lhc.Basics.v305∷*)) → (Lhc.Basics.v304∷*) → (Lhc.Basics.v306∷*)) String String String (x256521830∷String → String) (x243548158∷String → String);
                        in
                        (Lhc.Show.showParen∷Bool → (String → String) → String → String) (x9∷Bool) (x11∷String → String);
    _∷Main.Bar (Main.v51∷*) → <⊥:<unknown>:6:26: Unmatched pattern∷String → String>;)∷String → String
----
fullCheck: λx4∷Int.λx6∷Main.Bar (Main.v51∷*).
(case x6∷Main.Bar (Main.v51∷*) of
    Main.Bar (x10∷[x2∷*]) → let
        x8∷Main.Foo (Main.v51∷*) = Main.Foo (x10∷[x2∷*]);
        in let Main.11_aa∷Main.Foo (Main.v51∷*) = x8∷Main.Foo (Main.v51∷*); in
            let Main.10_d∷Int = x4∷Int; in let
                    x9∷Bool = (Lhc.Order.>=∷∀Lhc.Order.17_a.
                    (Lhc.Order.17_a∷*) → (Lhc.Order.17_a∷*) → Bool) Int (Main.10_d∷Int) (Int# 10);
                    in let
                        x11∷String → String = let
                            x256521830∷String → String =
                            (Lhc.Show.showString∷String → String → String) "Bar";
                            in let
                                x243548158∷String → String = let
                                    x230574400∷String → String =
                                    (Lhc.Show.showChar∷Char → String → String) (Char# 32);
                                    in let
                                        x217600726∷String → String =
                                        (Lhc.Show.showsPrec∷∀Lhc.Show.2_a.
                                        Int → (Lhc.Show.2_a∷*) → String → String) (Main.Foo (Main.v51∷*)) (Int# 10) (Main.11_aa∷Main.Foo (Main.v51∷*));
                                        in (Lhc.Basics..∷∀Lhc.Basics.v304.
                                                         ∀Lhc.Basics.v305.
                                                         ∀Lhc.Basics.v306.
                                        ((Lhc.Basics.v305∷*) → (Lhc.Basics.v306∷*)) → ((Lhc.Basics.v304∷*) → (Lhc.Basics.v305∷*)) → (Lhc.Basics.v304∷*) → (Lhc.Basics.v306∷*)) String String String (x230574400∷String → String) (x217600726∷String → String);
                                in (Lhc.Basics..∷∀Lhc.Basics.v304.
                                                 ∀Lhc.Basics.v305.
                                                 ∀Lhc.Basics.v306.
                                ((Lhc.Basics.v305∷*) → (Lhc.Basics.v306∷*)) → ((Lhc.Basics.v304∷*) → (Lhc.Basics.v305∷*)) → (Lhc.Basics.v304∷*) → (Lhc.Basics.v306∷*)) String String String (x256521830∷String → String) (x243548158∷String → String);
                        in
                        (Lhc.Show.showParen∷Bool → (String → String) → String → String) (x9∷Bool) (x11∷String → String);
    _∷Main.Bar (Main.v51∷*) → <⊥:<unknown>:6:26: Unmatched pattern∷String → String>;)∷String → String
----
fullCheck(nested): λx6∷Main.Bar (Main.v51∷*).
(case x6∷Main.Bar (Main.v51∷*) of
    Main.Bar (x10∷[x2∷*]) → let
        x8∷Main.Foo (Main.v51∷*) = Main.Foo (x10∷[x2∷*]);
        in let Main.11_aa∷Main.Foo (Main.v51∷*) = x8∷Main.Foo (Main.v51∷*); in
            let Main.10_d∷Int = x4∷Int; in let
                    x9∷Bool = (Lhc.Order.>=∷∀Lhc.Order.17_a.
                    (Lhc.Order.17_a∷*) → (Lhc.Order.17_a∷*) → Bool) Int (Main.10_d∷Int) (Int# 10);
                    in let
                        x11∷String → String = let
                            x256521830∷String → String =
                            (Lhc.Show.showString∷String → String → String) "Bar";
                            in let
                                x243548158∷String → String = let
                                    x230574400∷String → String =
                                    (Lhc.Show.showChar∷Char → String → String) (Char# 32);
                                    in let
                                        x217600726∷String → String =
                                        (Lhc.Show.showsPrec∷∀Lhc.Show.2_a.
                                        Int → (Lhc.Show.2_a∷*) → String → String) (Main.Foo (Main.v51∷*)) (Int# 10) (Main.11_aa∷Main.Foo (Main.v51∷*));
                                        in (Lhc.Basics..∷∀Lhc.Basics.v304.
                                                         ∀Lhc.Basics.v305.
                                                         ∀Lhc.Basics.v306.
                                        ((Lhc.Basics.v305∷*) → (Lhc.Basics.v306∷*)) → ((Lhc.Basics.v304∷*) → (Lhc.Basics.v305∷*)) → (Lhc.Basics.v304∷*) → (Lhc.Basics.v306∷*)) String String String (x230574400∷String → String) (x217600726∷String → String);
                                in (Lhc.Basics..∷∀Lhc.Basics.v304.
                                                 ∀Lhc.Basics.v305.
                                                 ∀Lhc.Basics.v306.
                                ((Lhc.Basics.v305∷*) → (Lhc.Basics.v306∷*)) → ((Lhc.Basics.v304∷*) → (Lhc.Basics.v305∷*)) → (Lhc.Basics.v304∷*) → (Lhc.Basics.v306∷*)) String String String (x256521830∷String → String) (x243548158∷String → String);
                        in
                        (Lhc.Show.showParen∷Bool → (String → String) → String → String) (x9∷Bool) (x11∷String → String);
    _∷Main.Bar (Main.v51∷*) → <⊥:<unknown>:6:26: Unmatched pattern∷String → String>;)∷String → String
----
fullCheck: λx6∷Main.Bar (Main.v51∷*).
(case x6∷Main.Bar (Main.v51∷*) of
    Main.Bar (x10∷[x2∷*]) → let
        x8∷Main.Foo (Main.v51∷*) = Main.Foo (x10∷[x2∷*]);
        in let Main.11_aa∷Main.Foo (Main.v51∷*) = x8∷Main.Foo (Main.v51∷*); in
            let Main.10_d∷Int = x4∷Int; in let
                    x9∷Bool = (Lhc.Order.>=∷∀Lhc.Order.17_a.
                    (Lhc.Order.17_a∷*) → (Lhc.Order.17_a∷*) → Bool) Int (Main.10_d∷Int) (Int# 10);
                    in let
                        x11∷String → String = let
                            x256521830∷String → String =
                            (Lhc.Show.showString∷String → String → String) "Bar";
                            in let
                                x243548158∷String → String = let
                                    x230574400∷String → String =
                                    (Lhc.Show.showChar∷Char → String → String) (Char# 32);
                                    in let
                                        x217600726∷String → String =
                                        (Lhc.Show.showsPrec∷∀Lhc.Show.2_a.
                                        Int → (Lhc.Show.2_a∷*) → String → String) (Main.Foo (Main.v51∷*)) (Int# 10) (Main.11_aa∷Main.Foo (Main.v51∷*));
                                        in (Lhc.Basics..∷∀Lhc.Basics.v304.
                                                         ∀Lhc.Basics.v305.
                                                         ∀Lhc.Basics.v306.
                                        ((Lhc.Basics.v305∷*) → (Lhc.Basics.v306∷*)) → ((Lhc.Basics.v304∷*) → (Lhc.Basics.v305∷*)) → (Lhc.Basics.v304∷*) → (Lhc.Basics.v306∷*)) String String String (x230574400∷String → String) (x217600726∷String → String);
                                in (Lhc.Basics..∷∀Lhc.Basics.v304.
                                                 ∀Lhc.Basics.v305.
                                                 ∀Lhc.Basics.v306.
                                ((Lhc.Basics.v305∷*) → (Lhc.Basics.v306∷*)) → ((Lhc.Basics.v304∷*) → (Lhc.Basics.v305∷*)) → (Lhc.Basics.v304∷*) → (Lhc.Basics.v306∷*)) String String String (x256521830∷String → String) (x243548158∷String → String);
                        in
                        (Lhc.Show.showParen∷Bool → (String → String) → String → String) (x9∷Bool) (x11∷String → String);
    _∷Main.Bar (Main.v51∷*) → <⊥:<unknown>:6:26: Unmatched pattern∷String → String>;)∷String → String
----
fullCheck(nested): (case x6∷Main.Bar (Main.v51∷*) of
    Main.Bar (x10∷[x2∷*]) → let
        x8∷Main.Foo (Main.v51∷*) = Main.Foo (x10∷[x2∷*]);
        in let Main.11_aa∷Main.Foo (Main.v51∷*) = x8∷Main.Foo (Main.v51∷*); in
            let Main.10_d∷Int = x4∷Int; in let
                    x9∷Bool = (Lhc.Order.>=∷∀Lhc.Order.17_a.
                    (Lhc.Order.17_a∷*) → (Lhc.Order.17_a∷*) → Bool) Int (Main.10_d∷Int) (Int# 10);
                    in let
                        x11∷String → String = let
                            x256521830∷String → String =
                            (Lhc.Show.showString∷String → String → String) "Bar";
                            in let
                                x243548158∷String → String = let
                                    x230574400∷String → String =
                                    (Lhc.Show.showChar∷Char → String → String) (Char# 32);
                                    in let
                                        x217600726∷String → String =
                                        (Lhc.Show.showsPrec∷∀Lhc.Show.2_a.
                                        Int → (Lhc.Show.2_a∷*) → String → String) (Main.Foo (Main.v51∷*)) (Int# 10) (Main.11_aa∷Main.Foo (Main.v51∷*));
                                        in (Lhc.Basics..∷∀Lhc.Basics.v304.
                                                         ∀Lhc.Basics.v305.
                                                         ∀Lhc.Basics.v306.
                                        ((Lhc.Basics.v305∷*) → (Lhc.Basics.v306∷*)) → ((Lhc.Basics.v304∷*) → (Lhc.Basics.v305∷*)) → (Lhc.Basics.v304∷*) → (Lhc.Basics.v306∷*)) String String String (x230574400∷String → String) (x217600726∷String → String);
                                in (Lhc.Basics..∷∀Lhc.Basics.v304.
                                                 ∀Lhc.Basics.v305.
                                                 ∀Lhc.Basics.v306.
                                ((Lhc.Basics.v305∷*) → (Lhc.Basics.v306∷*)) → ((Lhc.Basics.v304∷*) → (Lhc.Basics.v305∷*)) → (Lhc.Basics.v304∷*) → (Lhc.Basics.v306∷*)) String String String (x256521830∷String → String) (x243548158∷String → String);
                        in
                        (Lhc.Show.showParen∷Bool → (String → String) → String → String) (x9∷Bool) (x11∷String → String);
    _∷Main.Bar (Main.v51∷*) → <⊥:<unknown>:6:26: Unmatched pattern∷String → String>;)∷String → String
----
fullCheck: (case x6∷Main.Bar (Main.v51∷*) of
    Main.Bar (x10∷[x2∷*]) → let
        x8∷Main.Foo (Main.v51∷*) = Main.Foo (x10∷[x2∷*]);
        in let Main.11_aa∷Main.Foo (Main.v51∷*) = x8∷Main.Foo (Main.v51∷*); in
            let Main.10_d∷Int = x4∷Int; in let
                    x9∷Bool = (Lhc.Order.>=∷∀Lhc.Order.17_a.
                    (Lhc.Order.17_a∷*) → (Lhc.Order.17_a∷*) → Bool) Int (Main.10_d∷Int) (Int# 10);
                    in let
                        x11∷String → String = let
                            x256521830∷String → String =
                            (Lhc.Show.showString∷String → String → String) "Bar";
                            in let
                                x243548158∷String → String = let
                                    x230574400∷String → String =
                                    (Lhc.Show.showChar∷Char → String → String) (Char# 32);
                                    in let
                                        x217600726∷String → String =
                                        (Lhc.Show.showsPrec∷∀Lhc.Show.2_a.
                                        Int → (Lhc.Show.2_a∷*) → String → String) (Main.Foo (Main.v51∷*)) (Int# 10) (Main.11_aa∷Main.Foo (Main.v51∷*));
                                        in (Lhc.Basics..∷∀Lhc.Basics.v304.
                                                         ∀Lhc.Basics.v305.
                                                         ∀Lhc.Basics.v306.
                                        ((Lhc.Basics.v305∷*) → (Lhc.Basics.v306∷*)) → ((Lhc.Basics.v304∷*) → (Lhc.Basics.v305∷*)) → (Lhc.Basics.v304∷*) → (Lhc.Basics.v306∷*)) String String String (x230574400∷String → String) (x217600726∷String → String);
                                in (Lhc.Basics..∷∀Lhc.Basics.v304.
                                                 ∀Lhc.Basics.v305.
                                                 ∀Lhc.Basics.v306.
                                ((Lhc.Basics.v305∷*) → (Lhc.Basics.v306∷*)) → ((Lhc.Basics.v304∷*) → (Lhc.Basics.v305∷*)) → (Lhc.Basics.v304∷*) → (Lhc.Basics.v306∷*)) String String String (x256521830∷String → String) (x243548158∷String → String);
                        in
                        (Lhc.Show.showParen∷Bool → (String → String) → String → String) (x9∷Bool) (x11∷String → String);
    _∷Main.Bar (Main.v51∷*) → <⊥:<unknown>:6:26: Unmatched pattern∷String → String>;)∷String → String
----
Checking case bodies
----
fullCheck: let x8∷Main.Foo (Main.v51∷*) = Main.Foo (x10∷[x2∷*]); in let
        Main.11_aa∷Main.Foo (Main.v51∷*) = x8∷Main.Foo (Main.v51∷*);
        in let Main.10_d∷Int = x4∷Int; in let
                x9∷Bool = (Lhc.Order.>=∷∀Lhc.Order.17_a.
                (Lhc.Order.17_a∷*) → (Lhc.Order.17_a∷*) → Bool) Int (Main.10_d∷Int) (Int# 10);
                in let
                    x11∷String → String = let
                        x256521830∷String → String =
                        (Lhc.Show.showString∷String → String → String) "Bar";
                        in let
                            x243548158∷String → String = let
                                x230574400∷String → String =
                                (Lhc.Show.showChar∷Char → String → String) (Char# 32);
                                in let
                                    x217600726∷String → String =
                                    (Lhc.Show.showsPrec∷∀Lhc.Show.2_a.
                                    Int → (Lhc.Show.2_a∷*) → String → String) (Main.Foo (Main.v51∷*)) (Int# 10) (Main.11_aa∷Main.Foo (Main.v51∷*));
                                    in (Lhc.Basics..∷∀Lhc.Basics.v304.
                                                     ∀Lhc.Basics.v305.
                                                     ∀Lhc.Basics.v306.
                                    ((Lhc.Basics.v305∷*) → (Lhc.Basics.v306∷*)) → ((Lhc.Basics.v304∷*) → (Lhc.Basics.v305∷*)) → (Lhc.Basics.v304∷*) → (Lhc.Basics.v306∷*)) String String String (x230574400∷String → String) (x217600726∷String → String);
                            in (Lhc.Basics..∷∀Lhc.Basics.v304.∀Lhc.Basics.v305.
                                             ∀Lhc.Basics.v306.
                            ((Lhc.Basics.v305∷*) → (Lhc.Basics.v306∷*)) → ((Lhc.Basics.v304∷*) → (Lhc.Basics.v305∷*)) → (Lhc.Basics.v304∷*) → (Lhc.Basics.v306∷*)) String String String (x256521830∷String → String) (x243548158∷String → String);
                    in
                    (Lhc.Show.showParen∷Bool → (String → String) → String → String) (x9∷Bool) (x11∷String → String)
----
Checking Let:  (x8)  =  (Main.Foo (x10∷[x2∷*]))
----
fceq: (Main.Foo (x10∷[x2∷*]))
      (Main.Foo (Main.v51∷*))
----

eq: Vars don't match: (x2, Main.v51)
    Main.Foo (x2∷*)
    Main.Foo (Main.v51∷*)

Internal Error

Changed 6 years ago by SamB

  • description modified (diff)

Changed 6 years ago by SamB

  • status changed from new to closed
  • resolution set to fixed

Well, I fixed this issue, but the test still doesn't pass for seemingly unrelated reasons.

Note: See TracTickets for help on using tickets.