Skip to content

Compiling with more than 21 given will cause warning #23164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hxx0215 opened this issue May 14, 2025 · 0 comments
Open

Compiling with more than 21 given will cause warning #23164

hxx0215 opened this issue May 14, 2025 · 0 comments
Labels
area:implicits related to implicits area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug

Comments

@hxx0215
Copy link

hxx0215 commented May 14, 2025

Compiler version

3.6.4

Minimized code

class T1[F[_]]
class T2[F[_]]
class T3[F[_]]
class T4[F[_]]
class T5[F[_]]
class T6[F[_]]
class T7[F[_]]
class T8[F[_]]
class T9[F[_]]
class T10[F[_]]
class T11[F[_]]
class T12[F[_]]
class T13[F[_]]
class T14[F[_]]
class T15[F[_]]
class T16[F[_]]
class T17[F[_]]
class T18[F[_]]
class T19[F[_]]
class T20[F[_]]
class T21[F[_]]
class T22[F[_]]

class Result[F[_]: {T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22}]




val r = for
  t1 <- Option(new T1[Option])
  t2 <- Option(new T2[Option])
  t3 <- Option(new T3[Option])
  t4 <- Option(new T4[Option])
  t5 <- Option(new T5[Option])
  t6 <- Option(new T6[Option])
  t7 <- Option(new T7[Option])
  t8 <- Option(new T8[Option])
  t9 <- Option(new T9[Option])
  t10 <- Option(new T10[Option])
  t11 <- Option(new T11[Option])
  t12 <- Option(new T12[Option])
  t13 <- Option(new T13[Option])
  t14 <- Option(new T14[Option])
  t15 <- Option(new T15[Option])
  t16 <- Option(new T16[Option])
  t17 <- Option(new T17[Option])
  t18 <- Option(new T18[Option])
  t19 <- Option(new T19[Option])
  t20 <- Option(new T20[Option])
  t21 <- Option(new T21[Option])
  t22 <- Option(new T22[Option])
  given T1[Option] = t1
  given T2[Option] = t2
  given T3[Option] = t3
  given T4[Option] = t4
  given T5[Option] = t5
  given T6[Option] = t6
  given T7[Option] = t7
  given T8[Option] = t8
  given T9[Option] = t9
  given T10[Option] = t10
  given T11[Option] = t11
  given T12[Option] = t12
  given T13[Option] = t13
  given T14[Option] = t14
  given T15[Option] = t15
  given T16[Option] = t16
  given T17[Option] = t17
  given T18[Option] = t18
  given T19[Option] = t19
  given T20[Option] = t20
  given T21[Option] = t21
  given T22[Option] = t22
  result <- Option(new Result[Option])
yield result

Output

-- [E092] Pattern Match Unchecked Warning: test.scala:52:2 ---------------------------------------------------------------------------------------------------------------------------------
52 |  given T1[Option] = t1
   |  ^
   |  the type test for T1[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
-- [E092] Pattern Match Unchecked Warning: test.scala:53:2 ---------------------------------------------------------------------------------------------------------------------------------
53 |  given T2[Option] = t2
   |  ^
   |  the type test for T2[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
-- [E092] Pattern Match Unchecked Warning: test.scala:54:2 ---------------------------------------------------------------------------------------------------------------------------------
54 |  given T3[Option] = t3
   |  ^
   |  the type test for T3[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
-- [E092] Pattern Match Unchecked Warning: test.scala:55:2 ---------------------------------------------------------------------------------------------------------------------------------
55 |  given T4[Option] = t4
   |  ^
   |  the type test for T4[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
-- [E092] Pattern Match Unchecked Warning: test.scala:56:2 ---------------------------------------------------------------------------------------------------------------------------------
56 |  given T5[Option] = t5
   |  ^
   |  the type test for T5[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
-- [E092] Pattern Match Unchecked Warning: test.scala:57:2 ---------------------------------------------------------------------------------------------------------------------------------
57 |  given T6[Option] = t6
   |  ^
   |  the type test for T6[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
-- [E092] Pattern Match Unchecked Warning: test.scala:58:2 ---------------------------------------------------------------------------------------------------------------------------------
58 |  given T7[Option] = t7
   |  ^
   |  the type test for T7[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
-- [E092] Pattern Match Unchecked Warning: test.scala:59:2 ---------------------------------------------------------------------------------------------------------------------------------
59 |  given T8[Option] = t8
   |  ^
   |  the type test for T8[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
-- [E092] Pattern Match Unchecked Warning: test.scala:60:2 ---------------------------------------------------------------------------------------------------------------------------------
60 |  given T9[Option] = t9
   |  ^
   |  the type test for T9[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
-- [E092] Pattern Match Unchecked Warning: test.scala:61:2 ---------------------------------------------------------------------------------------------------------------------------------
61 |  given T10[Option] = t10
   |  ^
   |  the type test for T10[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
-- [E092] Pattern Match Unchecked Warning: test.scala:62:2 ---------------------------------------------------------------------------------------------------------------------------------
62 |  given T11[Option] = t11
   |  ^
   |  the type test for T11[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
-- [E092] Pattern Match Unchecked Warning: test.scala:63:2 ---------------------------------------------------------------------------------------------------------------------------------
63 |  given T12[Option] = t12
   |  ^
   |  the type test for T12[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
-- [E092] Pattern Match Unchecked Warning: test.scala:64:2 ---------------------------------------------------------------------------------------------------------------------------------
64 |  given T13[Option] = t13
   |  ^
   |  the type test for T13[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
-- [E092] Pattern Match Unchecked Warning: test.scala:65:2 ---------------------------------------------------------------------------------------------------------------------------------
65 |  given T14[Option] = t14
   |  ^
   |  the type test for T14[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
-- [E092] Pattern Match Unchecked Warning: test.scala:66:2 ---------------------------------------------------------------------------------------------------------------------------------
66 |  given T15[Option] = t15
   |  ^
   |  the type test for T15[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
-- [E092] Pattern Match Unchecked Warning: test.scala:67:2 ---------------------------------------------------------------------------------------------------------------------------------
67 |  given T16[Option] = t16
   |  ^
   |  the type test for T16[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
-- [E092] Pattern Match Unchecked Warning: test.scala:68:2 ---------------------------------------------------------------------------------------------------------------------------------
68 |  given T17[Option] = t17
   |  ^
   |  the type test for T17[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
-- [E092] Pattern Match Unchecked Warning: test.scala:69:2 ---------------------------------------------------------------------------------------------------------------------------------
69 |  given T18[Option] = t18
   |  ^
   |  the type test for T18[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
-- [E092] Pattern Match Unchecked Warning: test.scala:70:2 ---------------------------------------------------------------------------------------------------------------------------------
70 |  given T19[Option] = t19
   |  ^
   |  the type test for T19[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
-- [E092] Pattern Match Unchecked Warning: test.scala:71:2 ---------------------------------------------------------------------------------------------------------------------------------
71 |  given T20[Option] = t20
   |  ^
   |  the type test for T20[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
-- [E092] Pattern Match Unchecked Warning: test.scala:72:2 ---------------------------------------------------------------------------------------------------------------------------------
72 |  given T21[Option] = t21
   |  ^
   |  the type test for T21[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
-- [E092] Pattern Match Unchecked Warning: test.scala:73:2 ---------------------------------------------------------------------------------------------------------------------------------
73 |  given T22[Option] = t22
   |  ^
   |  the type test for T22[Option] cannot be checked at runtime because its type arguments can't be determined from Any
   |
   | longer explanation available when compiling with `-explain`
22 warnings found

Expectation

I think it can be compiled without any warnings.
Actually if I just give 21 givens the compiler is happy

@hxx0215 hxx0215 added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels May 14, 2025
@Gedochao Gedochao added area:reporting Error reporting including formatting, implicit suggestions, etc area:implicits related to implicits and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:implicits related to implicits area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug
Projects
None yet
Development

No branches or pull requests

2 participants