Skip to content

BigInt(1) to BigInt(3) gives infix warning under -source:3.1 #10383

Closed
@SethTisue

Description

@SethTisue

as expected 1 to 3 doesn't warn, but BigInt does. 3.0.0-M1 with -source:3.1:

scala> 1 to 5                                                                                                           
val res0: scala.collection.immutable.Range.Inclusive = Range 1 to 5

scala> BigInt(1) to BigInt(5)                                                                                           
1 |BigInt(1) to BigInt(5)
  |          ^^
  |Alphanumeric method to is not declared @infix; it should not be used as infix operator.
  |The operation can be rewritten automatically to `to` under -deprecation -rewrite.
  |Or rewrite to method syntax .to(...) manually.
val res1: scala.collection.immutable.NumericRange.Inclusive[BigInt] = NumericRange 1 to 5

I looked at checkValidInfix in Checking.scala, but it wasn't apparent to me what the problem is.

on Gitter, @smarter agreed this is weird/wrong:

ah, checkValidInfix checks !meth.maybeOwner.is(Scala2x)
so it shouldn't be warning on the BigInt

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions