Skip to content

Commit 297d266

Browse files
authored
Merge pull request #32 from armanbilge/feature/unchecked-variance
Add `@uncheckedVariance` annotations
2 parents e7cd13f + 2fc887c commit 297d266

File tree

8 files changed

+142
-0
lines changed

8 files changed

+142
-0
lines changed

annotation/src/main/scala-2.12/org/typelevel/scalaccompat/annotation/package.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,10 @@ package object annotation {
2828
type nowarn3 = nowarnIgnored
2929

3030
type targetName3 = targetNameIgnored
31+
32+
type uncheckedVariance = scala.annotation.unchecked.uncheckedVariance
33+
type uncheckedVariance2 = uncheckedVariance
34+
type uncheckedVariance212 = uncheckedVariance
35+
type uncheckedVariance213 = uncheckedVarianceIgnored
36+
type uncheckedVariance3 = uncheckedVarianceIgnored
3137
}

annotation/src/main/scala-2.13/org/typelevel/scalaccompat/annotation/package.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,11 @@ package object annotation {
2929

3030
type targetName3 = targetNameIgnored
3131

32+
type uncheckedVariance = scala.annotation.unchecked.uncheckedVariance
33+
type uncheckedVariance2 = uncheckedVariance
34+
type uncheckedVariance212 = uncheckedVarianceIgnored
35+
type uncheckedVariance213 = uncheckedVariance
36+
type uncheckedVariance3 = uncheckedVarianceIgnored
37+
3238
type unused = scala.annotation.unused
3339
}

annotation/src/main/scala-3/org/typelevel/scalaccompat/annotation/package.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,11 @@ package object annotation {
2929

3030
type targetName3 = scala.annotation.targetName
3131

32+
type uncheckedVariance = scala.annotation.unchecked.uncheckedVariance
33+
type uncheckedVariance2 = uncheckedVarianceIgnored
34+
type uncheckedVariance212 = uncheckedVarianceIgnored
35+
type uncheckedVariance213 = uncheckedVarianceIgnored
36+
type uncheckedVariance3 = uncheckedVariance
37+
3238
type unused = scala.annotation.unused
3339
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright 2022 Typelevel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.typelevel.scalaccompat.annotation
18+
package internal
19+
20+
private[annotation] class uncheckedVarianceIgnored extends scala.annotation.Annotation
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2022 Typelevel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.typelevel.scalaccompat.annotation
18+
19+
object CustomUncheckedVarianceHelper {
20+
trait Invariant[A]
21+
trait Invariant2[A]
22+
trait Invariant212[A]
23+
trait Invariant213[+A]
24+
trait Invariant3[+A]
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2022 Typelevel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.typelevel.scalaccompat.annotation
18+
19+
object CustomUncheckedVarianceHelper {
20+
trait Invariant[A]
21+
trait Invariant2[A]
22+
trait Invariant212[+A]
23+
trait Invariant213[A]
24+
trait Invariant3[+A]
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2022 Typelevel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.typelevel.scalaccompat.annotation
18+
19+
object CustomUncheckedVarianceHelper {
20+
trait Invariant[A]
21+
trait Invariant2[+A]
22+
trait Invariant212[+A]
23+
trait Invariant213[+A]
24+
trait Invariant3[A]
25+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright 2022 Typelevel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.typelevel.scalaccompat.annotation
18+
19+
import CustomUncheckedVarianceHelper._
20+
21+
object CustomUncheckedVarianceSuite {
22+
23+
class Covariant[+A] extends Invariant[A @uncheckedVariance]
24+
class Covariant2[+A] extends Invariant2[A @uncheckedVariance2]
25+
class Covariant212[+A] extends Invariant212[A @uncheckedVariance212]
26+
class Covariant213[+A] extends Invariant213[A @uncheckedVariance213]
27+
class Covariant3[+A] extends Invariant3[A @uncheckedVariance3]
28+
29+
}

0 commit comments

Comments
 (0)