[commit: ghc] master: Fix recompilation bug with default class methods (#15970) (288f681)

git at git.haskell.org git at git.haskell.org
Tue Dec 11 23:21:45 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/288f681e06accbae690c46eb8a6e997fa9e5f56a/ghc

>---------------------------------------------------------------

commit 288f681e06accbae690c46eb8a6e997fa9e5f56a
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Tue Dec 11 13:18:47 2018 -0500

    Fix recompilation bug with default class methods (#15970)
    
    If a module uses a class, then it can instantiate the class and
    thereby use its default methods, so we must include the default
    methods when calculating the fingerprint for the class.
    
    Test Plan:
    New unit test: driver/T15970
    
    Before:
    
    ```
    =====> T15970(normal) 1 of 1 [0, 0, 0]
    cd "T15970.run" && $MAKE -s --no-print-directory T15970
    Wrong exit code for T15970()(expected 0 , actual 2 )
    Stdout ( T15970 ):
    Makefile:13: recipe for target 'T15970' failed
    Stderr ( T15970 ):
    C.o:function Main_zdfTypeClassMyDataType1_info: error: undefined
    reference to 'A_toTypedData2_closure'
    C.o:function Main_main1_info: error: undefined reference to
    'A_toTypedData2_closure'
    C.o(.data+0x298): error: undefined reference to 'A_toTypedData2_closure'
    C.o(.data+0x480): error: undefined reference to 'A_toTypedData2_closure'
    collect2: error: ld returned 1 exit status
    `gcc' failed in phase `Linker'. (Exit code: 1)
    ```
    
    After: test passes.
    
    Reviewers: bgamari, simonpj, erikd, watashi, afarmer
    
    Subscribers: rwbarton, carter
    
    GHC Trac Issues: #15970
    
    Differential Revision: https://phabricator.haskell.org/D5394


>---------------------------------------------------------------

288f681e06accbae690c46eb8a6e997fa9e5f56a
 compiler/iface/MkIface.hs              | 78 ++++++++++++++++++++++++++++------
 testsuite/tests/driver/T15970/A1.hs    | 13 ++++++
 testsuite/tests/driver/T15970/A2.hs    | 13 ++++++
 testsuite/tests/driver/T15970/B.hs     |  9 ++++
 testsuite/tests/driver/T15970/C.hs     | 15 +++++++
 testsuite/tests/driver/T15970/Makefile | 17 ++++++++
 testsuite/tests/driver/T15970/all.T    |  2 +
 7 files changed, 134 insertions(+), 13 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 288f681e06accbae690c46eb8a6e997fa9e5f56a


More information about the ghc-commits mailing list