Should not allow repeated variable name in pattern

Bug #509939 reported by Matt Giuca
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mars
Fix Released
Low
Matt Giuca

Bug Description

Mars allows the same variable name to be used multiple times in a pattern, which means the variable will be bound several times. In the current backend (interpret), this binds the variable to its rightmost value.

eg:

x :: Pair(Int, Int)
switch x:
    case Pair(n, n):
        return n

It should be a compiler error. (Hugs gives the error: "Repeated variable "n" in pattern").

Tags: language

Related branches

Matt Giuca (mgiuca)
tags: added: language
Revision history for this message
Matt Giuca (mgiuca) wrote :

Fixed in trunk r951.

Changed in mars:
milestone: none → 0.3
status: Triaged → Fix Committed
Matt Giuca (mgiuca)
Changed in mars:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.