diff --git a/src/drc/drc/built-in-macros/_drc_complex_ops.rb b/src/drc/drc/built-in-macros/_drc_complex_ops.rb index 892e7ae1d..99ec74641 100644 --- a/src/drc/drc/built-in-macros/_drc_complex_ops.rb +++ b/src/drc/drc/built-in-macros/_drc_complex_ops.rb @@ -1516,8 +1516,8 @@ class DRCOpNodeCase < DRCOpNode types << a.result_type end end - if types.sort.uniq.size > 1 - raise("All result arguments need to have the same type (we got '" + types.collect(:to_s).join(",") + "')") + if types.uniq { |a,b| a.to_i <=> b.to_i }.size > 1 + raise("All result arguments of 'switch' need to render the same type (got '" + types.map!(&:to_s).join(",") + "')") end RBA::CompoundRegionOperationNode::new_case(nodes) diff --git a/testdata/drc/drcGenericTests_5.drc b/testdata/drc/drcGenericTests_5.drc index 33216870a..5f061d5da 100644 --- a/testdata/drc/drcGenericTests_5.drc +++ b/testdata/drc/drcGenericTests_5.drc @@ -20,6 +20,9 @@ l3.output(3, 0) l1.drc(rectangles).output(100, 0) l1.drc(primary.rectangles).output(101, 0) l2.drc(secondary(l1).rectangles).output(102, 0) +l1.drc(squares).output(103, 0) +l1.drc(primary.squares).output(104, 0) +l2.drc(secondary(l1).squares).output(105, 0) l1.drc(rectilinear).output(110, 0) l1.drc(primary.rectilinear).output(111, 0) @@ -37,8 +40,24 @@ l1.drc(! rectilinear).output(140, 0) l1.drc(! rectangles).output(141, 0) l1.drc(if_all(! rectangles, area < 8.0)).output(150, 0) -l1.drc(if_any(rectangles, area > 8.0)).output(151, 0) +l1.drc(if_any(rectangles, area >= 8.0)).output(151, 0) l1.drc(if_any(corners.count > 4)).output(160, 0) l1.drc(if_any(corners.count == 4)).output(161, 0) +l1.drc(switch(! rectangles, primary.sized(100.nm))).output(170, 0) +l1.drc(switch(! rectangles, primary.sized(100.nm), primary.sized(200.nm))).output(171, 0) + +error = "" +begin + l1.drc(switch(! rectangles, primary.sized(100.nm), squares, primary.sized(200.nm).edges)) +rescue => ex + error = ex.to_s +end +if error != "'drc': All result arguments of 'switch' need to render the same type (got 'Region,Edges')" + raise "switch did not give the right error when having different types. Was:\n" + error +end + +l1.drc(switch(! rectangles, primary.sized(100.nm), squares, primary.sized(200.nm))).output(172, 0) +l1.drc(switch(! rectangles, primary.sized(100.nm), squares, primary.sized(200.nm), primary)).output(173, 0) + diff --git a/testdata/drc/drcGenericTests_au5.gds b/testdata/drc/drcGenericTests_au5.gds index c904d68d3..54c61c071 100644 Binary files a/testdata/drc/drcGenericTests_au5.gds and b/testdata/drc/drcGenericTests_au5.gds differ diff --git a/testdata/drc/drcGenericTests_au5d.gds b/testdata/drc/drcGenericTests_au5d.gds index cd162191c..7ed51c6ee 100644 Binary files a/testdata/drc/drcGenericTests_au5d.gds and b/testdata/drc/drcGenericTests_au5d.gds differ