Opened 12 years ago
Closed 12 years ago
#1834 closed defect (invalid)
Name shadowing in match statements cause unintuitive type errors
Reported by: | Owned by: | somebody | |
---|---|---|---|
Priority: | high | Milestone: | 1.9.0 |
Component: | Frontend | Version: | trunk |
Keywords: | Cc: |
Description
Calling Test.test()
gives the error message Error: Invalid pattern: R() of type Integer
which is hard to see since m
isn't present in the case where the error occurs. This should 1) produce a warning for name shadowing (see #1833), 2) Not cause a type error if shadowing is allowed since m
is referenced outside the local variable definitions of the match statements.
package Test uniontype U record R end R; end U; function f input U m; algorithm _ := match m local Integer m; case R() then fail(); end match; end f; function test algorithm f(R()); end test; end Test;
Change History (2)
comment:1 by , 12 years ago
Component: | Backend → Frontend |
---|
comment:2 by , 12 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
It should be a name shadowing error. It is too easy to make things go bad if it doesn't.