Opened 10 years ago

Closed 10 years ago

#146 closed defect (fixed)

Report error on instance redefinition

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


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 (2)

comment:1 Changed 10 years ago by erikd

  • Status changed from new to assigned

comment:2 Changed 10 years ago by erikd

  • Resolution set to fixed
  • Status changed from assigned to closed

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.