File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 1+ -- [E161] Naming Error: tests/neg/i23119.scala:7:4 ---------------------------------------------------------------------
2+ 7 | given Option[List[Int]] = Some(List(x)) // error
3+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+ | given_Option_List is already defined as given instance given_Option_List
5+ |
6+ | Note that overloaded methods must all be defined in the same group of toplevel definitions
Original file line number Diff line number Diff line change 1+
2+ @ main def test = println :
3+ for x <- 1 to 2
4+ // works with explicit name
5+ // ols @ given Option[List[String]] = Some(List(x.toString))
6+ given Option [List [String ]] = Some (List (x.toString))
7+ given Option [List [Int ]] = Some (List (x)) // error
8+ yield summon[Option [List [String ]]].map(ss => ss.corresponds(given_Option_List.get)((a, b) => a == b.toString))
9+
10+ // The naming clash is noticed when defining local values for "packaging":
11+ // given_Option_List is already defined as given instance given_Option_List
12+ // Previously the naming clash was noticed when extracting values in the map or do function:
13+ // duplicate pattern variable: given_Option_List
You can’t perform that action at this time.
0 commit comments