From 4d765e3cd0a735f9a7e8d13fb6633f9ee534fbfb Mon Sep 17 00:00:00 2001 From: Moritz Drexl Date: Sat, 5 Aug 2017 16:44:40 +0200 Subject: Fix renaming after instance signature specializing (#660) * rework rename * Add regression test for Bug 613 * update tests * update changelog --- html-test/ref/Bug613.html | 260 +++++++++++++++++++++++++++++++++++++++++++ html-test/ref/Instances.html | 178 ++++++++++++++--------------- html-test/src/Bug613.hs | 16 +++ 3 files changed, 365 insertions(+), 89 deletions(-) create mode 100644 html-test/ref/Bug613.html create mode 100644 html-test/src/Bug613.hs (limited to 'html-test') diff --git a/html-test/ref/Bug613.html b/html-test/ref/Bug613.html new file mode 100644 index 00000000..924f37d4 --- /dev/null +++ b/html-test/ref/Bug613.html @@ -0,0 +1,260 @@ +Bug613

Safe HaskellSafe

Bug613

Synopsis

Documentation

class Functor f where #

Minimal complete definition

fmap

Methods

fmap :: (a -> b) -> f a -> f b #

Instances

Functor (Either a) #

Methods

fmap :: (a0 -> b) -> Either a a0 -> Either a b #

Functor (ThreeVars a0 a) #

Methods

fmap :: (a1 -> b) -> ThreeVars a0 a a1 -> ThreeVars a0 a b #

data ThreeVars a0 a b #

Phantom type a0 is added to block the first renaming from a to a0. This ensures that the renamer doesn't create a new conflict

Constructors

ThreeVars a b

Instances

Functor (ThreeVars a0 a) #

Methods

fmap :: (a1 -> b) -> ThreeVars a0 a a1 -> ThreeVars a0 a b #

\ No newline at end of file diff --git a/html-test/ref/Instances.html b/html-test/ref/Instances.html index b014e8df..c9ca6f82 100644 --- a/html-test/ref/Instances.html +++ b/html-test/ref/Instances.html @@ -102,9 +102,9 @@ window.onload = function () {pageLoad();}; ><~~ Int) -> a -> a ) -> a0 -> a <~~ a a0 #

<~~ (a <~~ a)) -> a0)) -> Int -> a <~~Either a Int -> a -> -> a0 -> Either a a a a0 #

Either a (Either a a) -> a a0) -> Int -> Eitherfoo :: (f a, Int) -> a -> (f a, a) ) -> a0 -> (f a, a0) #

foo' :: (f a, (f a, a)) -> :: (f a, (f a, a0)) -> Int -> (f a, (f a, Int<~~ Int) -> a -> a ) -> a0 -> a <~~ a a0 #

<~~ (a <~~ a)) -> a0)) -> Int -> a <~~foo :: (a, a, Int) -> a -> (a, a, a) ) -> a0 -> (a, a, a0) #

foo' :: (a, a, (a, a, a)) -> :: (a, a, (a, a, a0)) -> Int -> (a, a, (a, a, IntQuux a b Int -> a -> -> a0 -> Quux a b a a b a0 #

Quux a b (Quux a b a) -> a b a0) -> Int -> QuuxLiftedRep) a Int -> a -> ( -> a0 -> (LiftedRep -> LiftedRep) a a ) a a0 #

LiftedRep -> LiftedRep) a a) -> ) a a0) -> Int -> (LiftedRep

bar' :: (a, b, (a, b, (a, b, a))) -> (a, b, (a, b, (a, b, b))) :: (a, b, (a, b, (a, b, a))) -> (a, b, (a, b, (a, b, b0))) #

bar0 :: ((a, b, (a, b, a)), (a, b, (a, b, a))) -> ((a, b, b), (a, b, c)) :: ((a, b, (a, b, a)), (a, b, (a, b, a))) -> ((a, b, b0), (a, b, c)) #

bar1 :: ((a, b, (a, b, a)), (a, b, (a, b, a))) -> ((a, b, b), (a, b, c)) :: ((a, b, (a, b, a)), (a, b, (a, b, a))) -> ((a, b, b0), (a, b, c)) #

Quux a c (Quux a c b)) a c b0)) #

Quux a b c)) -> (Quux a c b, a c b0, Quux a c c) a c c0) #

Quux a b c)) -> (Quux a c b, a c b0, Quux a c c) a c c0) #

forall a. a -> a) -> (b, forall a. a -> [c]) -> (b, c) c0. c0 -> [c]) -> (b, c1) #

forall b. (forall a. a -> [c]) -> c) -> b. b -> [c]) -> c0) -> forall a. a -> b c1. c1 -> b #

baz :: (a -> b) -> (forall c. c -> c) -> (b, a0. a0 -> a0) -> (b0, forall c. c -> a -> b) -> (b, c) c. c -> a -> b) -> (b0, c) #

baz' :: b -> ( :: b0 -> (forall c. c -> a -> b) -> ( b1. b1 -> a -> b) -> (forall c. c -> a -> b) -> [(b, a -> b)] b2. b2 -> a -> b) -> [(b0, a -> b)] #

baz'' :: b -> ( :: b0 -> (forall c. ( b1. (forall d. d -> a -> b) -> c) -> b2. b2 -> a -> b) -> c) -> forall c. c -> b c. c -> b0 #

baz :: (a, b, c) -> (forall d. d -> d) -> (b, a0. a0 -> a0) -> (b0, forall d. d -> (a, b, c)) -> (b, c) c0. c0 -> (a, b, c)) -> (b0, c1) #

baz' :: b -> ( :: b0 -> (forall d. d -> (a, b, c)) -> ( b1. b1 -> (a, b, c)) -> (forall d. d -> (a, b, c)) -> [(b, (a, b, c))] b2. b2 -> (a, b, c)) -> [(b0, (a, b, c))] #

baz'' :: b -> ( :: b0 -> (forall d. ( b1. (forall e. e -> (a, b, c)) -> c) -> b2. b2 -> (a, b, c)) -> c0) -> forall d. d -> b c1. c1 -> b0 #

Quux a b c -> (forall d. d -> d) -> (b, a0. a0 -> a0) -> (b0, forall d. d -> c0. c0 -> Quux a b c) -> (b, c) a b c) -> (b0, c1) #

baz' :: b -> ( :: b0 -> (forall d. d -> b1. b1 -> Quux a b c) -> (forall d. d -> b2. b2 -> Quux a b c) -> [(b, a b c) -> [(b0, Quux a b c)] #

baz'' :: b -> ( :: b0 -> (forall d. ( b1. (forall e. e -> b2. b2 -> Quux a b c) -> c) -> a b c) -> c0) -> forall d. d -> b c1. c1 -> b0 #

baz :: (a, [b], b, a) -> (forall c. c -> c) -> (b, a0. a0 -> a0) -> (b0, forall c. c -> (a, [b], b, a)) -> (b, c) c. c -> (a, [b], b, a)) -> (b0, c) #

baz' :: b -> ( :: b0 -> (forall c. c -> (a, [b], b, a)) -> ( b1. b1 -> (a, [b], b, a)) -> (forall c. c -> (a, [b], b, a)) -> [(b, (a, [b], b, a))] b2. b2 -> (a, [b], b, a)) -> [(b0, (a, [b], b, a))] #

baz'' :: b -> ( :: b0 -> (forall c. ( b1. (forall d. d -> (a, [b], b, a)) -> c) -> b2. b2 -> (a, [b], b, a)) -> c) -> forall c. c -> b c. c -> b0 #

Quux a b Int -> a -> -> a0 -> Quux a b a a b a0 #

Quux a b (Quux a b a) -> a b a0) -> Int -> QuuxQuux a c (Quux a c b)) a c b0)) #

Quux a b c)) -> (Quux a c b, a c b0, Quux a c c) a c c0) #

Quux a b c)) -> (Quux a c b, a c b0, Quux a c c) a c c0) #

Quux a b c -> (forall d. d -> d) -> (b, a0. a0 -> a0) -> (b0, forall d. d -> c0. c0 -> Quux a b c) -> (b, c) a b c) -> (b0, c1) #

baz' :: b -> ( :: b0 -> (forall d. d -> b1. b1 -> Quux a b c) -> (forall d. d -> b2. b2 -> Quux a b c) -> [(b, a b c) -> [(b0, Quux a b c)] #

baz'' :: b -> ( :: b0 -> (forall d. ( b1. (forall e. e -> b2. b2 -> Quux a b c) -> c) -> a b c) -> c0) -> forall d. d -> b c1. c1 -> b0 #

b) -> f a -> f b + +instance Functor (Either a) where + fmap _ (Left x) = Left x + fmap f (Right y) = Right (f y) + +-- | Phantom type a0 is added to block the first renaming from a to a0. This ensures that the renamer doesn't create a new conflict +data ThreeVars a0 a b = ThreeVars a b + +instance Functor (ThreeVars a0 a) where + fmap f (ThreeVars a b) = ThreeVars a (f b) -- cgit v1.2.3