Skip to content

String no longer taken as generic SeqOps #14927

Closed
@mcallisto

Description

@mcallisto

Compiler version

Scala 3.1.2

Minimized code

import scala.collection.SeqOps
def foo[A, CC[B] <: SeqOps[B, CC, CC[B]]](seq: CC[A]): CC[A] = seq.tail
def test: Unit = foo("ABC")

Output

Found:    ("ABC" : String)
Required: collection.SeqOps[A, 
  [B] =>> 
    collection.SeqOps[B, 
      [B] =>> 
        collection.SeqOps[B², 
          [B] =>> 
            ...collection.SeqOps[B³, [B] =>> ...[..., ..., ...], 
              ...SeqOps[B³, [B...] =>> ..., ...[..., ..., ...]]
            ]
        , 
          collection.SeqOps[B², [B] =>> ...SeqOps[B⁴², ..., ...], 
            ....SeqOps[B², [B] =>> ..., ...[..., ..., ...]]
          ]
        ]
    , 
      collection.SeqOps[B, 
        [B] =>> 
          collection.SeqOps[B⁵⁷, [B] =>> ...SeqOps[B⁵⁸, ..., ...], 
            ....SeqOps[B⁵⁷, [B] =>> ..., ...[..., ..., ...]]
          ]
      , 
        collection.SeqOps[B, 
          [B] =>> ....SeqOps[B⁶⁶, [B] =>> ..., ...[..., ..., ...]]
        , 
          ...collection.SeqOps[B, [B] =>> ...[..., ..., ...], 
            ...SeqOps[B, ..., ...]
          ]
        ]
      ]
    ]
, 
  collection.SeqOps[A, 
    [B] =>> 
      collection.SeqOps[B⁷³, 
        [B] =>> 
          ...collection.SeqOps[B⁷⁴, [B] =>> ...[..., ..., ...], 
            ...SeqOps[B⁷⁴, [B...] =>> ..., ...[..., ..., ...]]
          ]
      , 
        collection.SeqOps[B⁷³, 
          [B] =>> ...SeqOps[B⁷⁸, [B...] =>> ..., ...[..., ..., ...]]
        , ....SeqOps[B⁷³, [B] =>> ...[..., ..., ...], ...SeqOps[..., ..., ...]]]
      ]
  , 
    collection.SeqOps[A, 
      [B] =>> 
        collection.SeqOps[B⁸², [B] =>> ...SeqOps[B⁸³, ..., ...], 
          ....SeqOps[B⁸², [B] =>> ..., ...[..., ..., ...]]
        ]
    , 
      collection.SeqOps[A, 
        [B] =>> ....SeqOps[B⁸⁶, [B] =>> ..., ...[..., ..., ...]]
      , 
        ...collection.SeqOps[A, [B] =>> ...[..., ..., ...], 
          ...SeqOps[A, [B...] =>> ..., ...[..., ..., ...]]
        ]
      ]
    ]
  ]
]

where:    A   is a type variable
          B   is a type variable
          B²  is a type variable
          B²² is a type variable
          B²³ is a type variable
          B²¹ is a type variable
          B²⁰ is a type variable
          B²⁴ is a type variable
          B²⁵ is a type variable
          B²⁶ is a type variable
          B²⁷ is a type variable
          B²⁸ is a type variable
          B²⁹ is a type variable
          B³  is a type variable
          B³² is a type variable
          B³³ is a type variable
          B³¹ is a type variable
          B³⁰ is a type variable
          B³⁴ is a type variable
          B³⁵ is a type variable
          B³⁶ is a type variable
          B³⁷ is a type variable
          B³⁸ is a type variable
          B³⁹ is a type variable
          B¹² is a type variable
          B¹³ is a type variable
          B¹¹ is a type variable
          B¹⁰ is a type variable
          B¹⁴ is a type variable
          B¹⁵ is a type variable
          B¹⁶ is a type variable
          B¹⁷ is a type variable
          B¹⁸ is a type variable
          B¹⁹ is a type variable
          B⁴  is a type variable
          B⁴² is a type variable
          B⁴³ is a type variable
          B⁴¹ is a type variable
          B⁴⁰ is a type variable
          B⁴⁴ is a type variable
          B⁴⁵ is a type variable
          B⁴⁶ is a type variable
          B⁴⁷ is a type variable
          B⁴⁸ is a type variable
          B⁴⁹ is a type variable
          B⁵  is a type variable
          B⁵² is a type variable
          B⁵³ is a type variable
          B⁵¹ is a type variable
          B⁵⁰ is a type variable
          B⁵⁴ is a type variable
          B⁵⁵ is a type variable
          B⁵⁶ is a type variable
          B⁵⁷ is a type variable
          B⁵⁸ is a type variable
          B⁵⁹ is a type variable
          B⁶  is a type variable
          B⁶² is a type variable
          B⁶³ is a type variable
          B⁶¹ is a type variable
          B⁶⁰ is a type variable
          B⁶⁴ is a type variable
          B⁶⁵ is a type variable
          B⁶⁶ is a type variable
          B⁶⁷ is a type variable
          B⁶⁸ is a type variable
          B⁶⁹ is a type variable
          B⁷  is a type variable
          B⁷² is a type variable
          B⁷³ is a type variable
          B⁷¹ is a type variable
          B⁷⁰ is a type variable
          B⁷⁴ is a type variable
          B⁷⁵ is a type variable
          B⁷⁶ is a type variable
          B⁷⁷ is a type variable
          B⁷⁸ is a type variable
          B⁷⁹ is a type variable
          B⁸  is a type variable
          B⁸² is a type variable
          B⁸³ is a type variable
          B⁸¹ is a type variable
          B⁸⁰ is a type variable
          B⁸⁴ is a type variable
          B⁸⁵ is a type variable
          B⁸⁶ is a type variable
          B⁸⁷ is a type variable
          B⁸⁸ is a type variable
          B⁸⁹ is a type variable
          B⁹  is a type variable

Expectation

In Scala 3.1.1 and before the code compiles just fine.

As mentioned by @nicolasstucki here where first reported https://users.scala-lang.org/t/scala-3-1-2-change-string-no-longer-working-with-seqops/8424, the issue seems to be related with the implicit conversion from String into Seq[Char].

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions