Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#10846 closed bug (fixed)

PartialTypeSignatures change implicit CallStack behavior

Reported by: nitromaster101 Owned by: gridaphobe
Priority: normal Milestone: 8.0.1
Component: Compiler Version: 7.10.2
Keywords: Cc: gridaphobe
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D1422
Wiki Page:

Description (last modified by nitromaster101)

I'm using GHC head at 062feee4e7408ad5b9d882e5fed2c700e337db72

I have two functions, f and f2 which are identical expect for the use of PartialTypeSignatures in f2. GHC produces a warning and says that f2's wildcard is filled in by String, which is correct.

{-# LANGUAGE ImplicitParams, PartialTypeSignatures #-}

import GHC.Types

f :: (?loc :: CallStack) => String
f = show $ map (srcLocStartLine . snd) $ getCallStack ?loc

f2 :: (?loc :: CallStack) => _
f2 = show $ map (srcLocStartLine . snd) $ getCallStack ?loc

f_caller = f
f2_caller = f2
[1 of 1] Compiling Main             ( Bug2.hs, interpreted )

Bug2.hs:8:30: warning:
    Found type wildcard ‘_’ standing for ‘String’
    In the type signature for:
      f2 :: (?loc :: CallStack) => _
Ok, modules loaded: Main.
*Main> f_caller
*Main> f2_caller

f2_caller should have two entries (f2_caller's line and f2's line), just like f_caller.

Change History (7)

comment:1 Changed 4 years ago by nitromaster101

Cc: gridaphobe added

comment:2 Changed 4 years ago by nitromaster101

Another version of f2 produces the same incorrect behavior:

f2 :: (?loc :: CallStack, _) => String
f2 = show $ map (srcLocStartLine . snd) $ getCallStack ?loc

It's the same idea, but now the wildcard is in the constraints, even when it unifies with ().

comment:3 Changed 4 years ago by nitromaster101

Description: modified (diff)

comment:4 Changed 4 years ago by gridaphobe

Owner: set to gridaphobe

comment:5 Changed 4 years ago by gridaphobe

Differential Rev(s): Phab:D1422
Status: newpatch

This seems to be fixed by 1e041b7, but I've added a test-case in my patch for the slightly related #10845.

comment:6 Changed 4 years ago by gridaphobe

Resolution: fixed
Status: patchclosed

comment:7 Changed 4 years ago by thomie

Milestone: 8.0.1
Note: See TracTickets for help on using tickets.