Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#213 closed defect (fixed)

Freakout on name clash

Reported by: erikd Owned by: amosrobinson
Priority: normal Milestone:
Component: Source Semantics Version: 0.1.2
Keywords: Cc:


Simple module (stripped down version of Data.ArrayU):

{-# OPTIONS -no-implicit-prelude #-}

import	Base

-- An array of unboxed ints
data ArrayU %r a

foreign import "primArrayU_Int_set"
 arrayUI_set :: ArrayU (Int{write}) {read} -> Int{read} -> Int -> ()

-- A fast, unchecked write to an array.
foreign import "primArrayInt32_poke"
 	:: forall %r1 %r2 %r3 %r4
	.  ArrayU %r1 (Int %r2) -> Int32# -($c1)> Int32# -(!e2 $c2)> ()
	:- $c1 = ${a : ArrayU %r1 (Int %r2)}
	,  $c2 = ${a : ArrayU %r1 (Int %r2)} + ${ix : Int32#}
	,  !e2 = !Read %r1 + !Write %r2 + !Read %r3 + !Read %r4
	,  Mutable %r2
	:$ Obj -> Int32# -> Int32# -> Obj

arrayUI_poke array i x = arrayUI_set i x

results in:

FREAKOUT in Core.Thread
 thread_transX: can't find a witness of kind Mutable %rTS1
state = [((Mutable, Test.%r2), +xC0)]

The problem is that arrayUI_poke is already defined as a foreign import-ed function.

Need a nice error message instead of a freakout.

Change History (4)

comment:1 Changed 9 years ago by erikd

  • Type changed from newbie to defect

comment:2 Changed 9 years ago by amosrobinson

  • Owner set to amosrobinson
  • Status changed from new to assigned

This affects out-of-order function bindings too:

id x = x
je y = y
id z = z

should error because the clauses aren't consecutive.

It seems like GHC is a little smarter with CAFs too, because two consecutive CAFs cause an error.

This is partly fixed. Outstanding:

  • Consecutive CAFs aren't causing errors,
  • Source position for foreign imports is just showing as '?'.

comment:3 Changed 9 years ago by amosrobinson

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

Consecutive CAFs error and source positions for foreign imports work, marking as fixed.

Test is in 13-Renamer/T213-NameClash.

comment:4 Changed 8 years ago by benl

  • Milestone 0.1.3 deleted

Milestone 0.1.3 deleted

Note: See TracTickets for help on using tickets.