Ticket #146 (closed defect: fixed)

Opened 5 years ago

Last modified 4 years ago

Report error on instance redefinition

Reported by: erikd Owned by: erikd
Priority: blocker Milestone:
Component: Source Parser Version: 0.1.2
Keywords: Cc:

Description

This code:

data Whatever = A Int | B String

instance Show Whatever where
	show (A _) = "integer"
	show (B _) = "string"

instance Show Whatever where
	show (A x) = show x
	show (B x) = show x

fails at the C compile stage with:

./Test.ddc.c:96: error: redefinition of 'Test_instance_Show_Whatever_show'
./Test.ddc.c:46: note: previous definition of 'Test_instance_Show_Whatever_show' was here

Instead, it should result in a compiler error because the instance is being redefined.

This is related to bug #33 (Check for conflicting projection functions).

Change History

Changed 5 years ago by erikd

  • status changed from new to assigned

Changed 4 years ago by erikd

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

Fixed in the following commit:

Sat Feb 13 22:25:23 EST 2010 Erik de Castro Lopo <erikd@…>

  • Fix #146: Raise error on a redefined class instance.
Note: See TracTickets for help on using tickets.