Skip to content

Commit

Permalink
Merge pull request #32 from armanbilge/feature/unchecked-variance
Browse files Browse the repository at this point in the history
Add `@uncheckedVariance` annotations
  • Loading branch information
armanbilge authored Jun 26, 2023
2 parents e7cd13f + 2fc887c commit 297d266
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,10 @@ package object annotation {
type nowarn3 = nowarnIgnored

type targetName3 = targetNameIgnored

type uncheckedVariance = scala.annotation.unchecked.uncheckedVariance
type uncheckedVariance2 = uncheckedVariance
type uncheckedVariance212 = uncheckedVariance
type uncheckedVariance213 = uncheckedVarianceIgnored
type uncheckedVariance3 = uncheckedVarianceIgnored
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,11 @@ package object annotation {

type targetName3 = targetNameIgnored

type uncheckedVariance = scala.annotation.unchecked.uncheckedVariance
type uncheckedVariance2 = uncheckedVariance
type uncheckedVariance212 = uncheckedVarianceIgnored
type uncheckedVariance213 = uncheckedVariance
type uncheckedVariance3 = uncheckedVarianceIgnored

type unused = scala.annotation.unused
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,11 @@ package object annotation {

type targetName3 = scala.annotation.targetName

type uncheckedVariance = scala.annotation.unchecked.uncheckedVariance
type uncheckedVariance2 = uncheckedVarianceIgnored
type uncheckedVariance212 = uncheckedVarianceIgnored
type uncheckedVariance213 = uncheckedVarianceIgnored
type uncheckedVariance3 = uncheckedVariance

type unused = scala.annotation.unused
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright 2022 Typelevel
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.typelevel.scalaccompat.annotation
package internal

private[annotation] class uncheckedVarianceIgnored extends scala.annotation.Annotation
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2022 Typelevel
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.typelevel.scalaccompat.annotation

object CustomUncheckedVarianceHelper {
trait Invariant[A]
trait Invariant2[A]
trait Invariant212[A]
trait Invariant213[+A]
trait Invariant3[+A]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2022 Typelevel
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.typelevel.scalaccompat.annotation

object CustomUncheckedVarianceHelper {
trait Invariant[A]
trait Invariant2[A]
trait Invariant212[+A]
trait Invariant213[A]
trait Invariant3[+A]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2022 Typelevel
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.typelevel.scalaccompat.annotation

object CustomUncheckedVarianceHelper {
trait Invariant[A]
trait Invariant2[+A]
trait Invariant212[+A]
trait Invariant213[+A]
trait Invariant3[A]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2022 Typelevel
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.typelevel.scalaccompat.annotation

import CustomUncheckedVarianceHelper._

object CustomUncheckedVarianceSuite {

class Covariant[+A] extends Invariant[A @uncheckedVariance]
class Covariant2[+A] extends Invariant2[A @uncheckedVariance2]
class Covariant212[+A] extends Invariant212[A @uncheckedVariance212]
class Covariant213[+A] extends Invariant213[A @uncheckedVariance213]
class Covariant3[+A] extends Invariant3[A @uncheckedVariance3]

}

0 comments on commit 297d266

Please sign in to comment.