Skip to content
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

Remove extended experimental checking #13093

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 0 additions & 41 deletions compiler/src/dotty/tools/dotc/typer/RefChecks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -995,20 +995,6 @@ object RefChecks {
then
Feature.checkExperimentalDef(sym, pos)

private def checkExperimentalSignature(sym: Symbol, pos: SrcPos)(using Context): Unit =
val checker = new TypeTraverser:
def traverse(tp: Type): Unit =
if tp.typeSymbol.isExperimental then
Feature.checkExperimentalDef(tp.typeSymbol, pos)
else
traverseChildren(tp)
if !sym.owner.isExperimental && !pos.span.isSynthetic then // avoid double errors
checker.traverse(sym.info)

private def checkExperimentalAnnots(sym: Symbol)(using Context): Unit =
for annot <- sym.annotations if annot.symbol.isExperimental && annot.tree.span.exists do
Feature.checkExperimentalDef(annot.symbol, annot.tree)

/** If @migration is present (indicating that the symbol has changed semantics between versions),
* emit a warning.
*/
Expand Down Expand Up @@ -1221,16 +1207,6 @@ object RefChecks {
f(variableName, variableOffset)

end checkImplicitNotFoundAnnotation


/** Check that classes extending experimental classes or nested in experimental classes have the @experimental annotation. */
private def checkExperimentalInheritance(cls: ClassSymbol)(using Context): Unit =
if !cls.hasAnnotation(defn.ExperimentalAnnot) then
cls.info.parents.find(_.typeSymbol.isExperimental) match
case Some(parent) =>
report.error(em"extension of experimental ${parent.typeSymbol} must have @experimental annotation", cls.srcPos)
case _ =>
end checkExperimentalInheritance
}
import RefChecks._

Expand Down Expand Up @@ -1287,8 +1263,6 @@ class RefChecks extends MiniPhase { thisPhase =>
override def transformValDef(tree: ValDef)(using Context): ValDef = {
checkNoPrivateOverrides(tree)
checkDeprecatedOvers(tree)
checkExperimentalAnnots(tree.symbol)
checkExperimentalSignature(tree.symbol, tree)
val sym = tree.symbol
if (sym.exists && sym.owner.isTerm) {
tree.rhs match {
Expand All @@ -1309,8 +1283,6 @@ class RefChecks extends MiniPhase { thisPhase =>
override def transformDefDef(tree: DefDef)(using Context): DefDef = {
checkNoPrivateOverrides(tree)
checkDeprecatedOvers(tree)
checkExperimentalAnnots(tree.symbol)
checkExperimentalSignature(tree.symbol, tree)
checkImplicitNotFoundAnnotation.defDef(tree.symbol.denot)
checkUnaryMethods(tree.symbol)
tree
Expand All @@ -1324,8 +1296,6 @@ class RefChecks extends MiniPhase { thisPhase =>
checkCompanionNameClashes(cls)
checkAllOverrides(cls)
checkImplicitNotFoundAnnotation.template(cls.classDenot)
checkExperimentalInheritance(cls)
checkExperimentalAnnots(cls)
tree
}
catch {
Expand Down Expand Up @@ -1370,17 +1340,6 @@ class RefChecks extends MiniPhase { thisPhase =>
}
tree
}

override def transformTypeTree(tree: TypeTree)(using Context): TypeTree = {
checkExperimental(tree.symbol, tree.srcPos)
tree
}

override def transformTypeDef(tree: TypeDef)(using Context): TypeDef = {
checkExperimental(tree.symbol, tree.srcPos)
checkExperimentalAnnots(tree.symbol)
tree
}
}

/* todo: rewrite and re-enable
Expand Down
3 changes: 3 additions & 0 deletions tests/pos/i13091.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import annotation.experimental
@experimental trait Foo
val foo = new (Foo @experimental) {}