Skip to content

Commit

Permalink
Removed superfluous method override return types.
Browse files Browse the repository at this point in the history
All tests pass
  • Loading branch information
NicolasRouquette committed May 16, 2022
1 parent aba3a19 commit 7293985
Show file tree
Hide file tree
Showing 35 changed files with 211 additions and 211 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trait Analyzer extends AstStateVisitor {
case None => Right(a)
}

override def transUnit(a: Analysis, tu: Ast.TransUnit): Result =
override def transUnit(a: Analysis, tu: Ast.TransUnit) =
visitList(a, tu.members, matchTuMember)

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ trait TypeExpressionAnalyzer

def typeNameNode(a: Analysis, node: AstNode[Ast.TypeName]): Out = matchTypeNameNode(a, node)

override def typeNameStringNode(a: Analysis, node: AstNode[Ast.TypeName], tn: Ast.TypeNameString): Out =
override def typeNameStringNode(a: Analysis, node: AstNode[Ast.TypeName], tn: Ast.TypeNameString) =
opt(exprNode)(a, tn.size)

override def defArrayAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefArray]]): Either[Error,State] = {
override def defArrayAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefArray]]) = {
val (_, node1, _) = node
val data = node1.data
for {
Expand All @@ -57,7 +57,7 @@ trait TypeExpressionAnalyzer
} yield a
}

override def defComponentInstanceAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefComponentInstance]]): Either[Error,State] = {
override def defComponentInstanceAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefComponentInstance]]) = {
val (_, node1, _) = node
val data = node1.data
for {
Expand All @@ -70,13 +70,13 @@ trait TypeExpressionAnalyzer
} yield a
}

override def defConstantAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefConstant]]): Result = {
override def defConstantAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefConstant]]) = {
val (_, node1, _) = node
val data = node1.data
exprNode(a, data.value)
}

override def defEnumAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefEnum]]): Either[Error,State] = {
override def defEnumAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefEnum]]) = {
val (_, node1, _) = node
val data = node1.data
for {
Expand All @@ -86,7 +86,7 @@ trait TypeExpressionAnalyzer
} yield a
}

override def defPortAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefPort]]): Either[Error,State] = {
override def defPortAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefPort]]) = {
val (_, node1, _) = node
val data = node1.data
for {
Expand All @@ -95,7 +95,7 @@ trait TypeExpressionAnalyzer
} yield a
}

override def defStructAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefStruct]]): Either[Error,State] = {
override def defStructAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefStruct]]) = {
val (_, node1, _) = node
val data = node1.data
for {
Expand All @@ -104,25 +104,25 @@ trait TypeExpressionAnalyzer
} yield a
}

override def exprArrayNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprArray): Result =
override def exprArrayNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprArray) =
visitList(a, e.elts, exprNode)

override def exprBinopNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprBinop): Either[Error,State] =
override def exprBinopNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprBinop) =
for {
a <- exprNode(a, e.e1)
a <- exprNode(a, e.e2)
} yield a

override def exprDotNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprDot): Result = exprNode(a, e.e)
override def exprDotNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprDot) = exprNode(a, e.e)

override def exprParenNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprParen): Result = exprNode(a, e.e)
override def exprParenNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprParen) = exprNode(a, e.e)

override def exprStructNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprStruct): Result =
override def exprStructNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprStruct) =
visitList(a, e.members, structMemberNode)

override def exprUnopNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprUnop): Result = exprNode(a, e.e)
override def exprUnopNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprUnop) = exprNode(a, e.e)

override def specCommandAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecCommand]]): Either[Error,State] = {
override def specCommandAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecCommand]]) = {
val (_, node1, _) = node
val data = node1.data
for {
Expand All @@ -148,7 +148,7 @@ trait TypeExpressionAnalyzer
}
}

override def specEventAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecEvent]]): Either[Error,State] = {
override def specEventAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecEvent]]) = {
val (_, node1, _) = node
val data = node1.data
for {
Expand All @@ -158,12 +158,12 @@ trait TypeExpressionAnalyzer
} yield a
}

override def specInitAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecInit]]): Result = {
override def specInitAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecInit]]) = {
val data = aNode._2.data
exprNode(a, data.phase)
}

override def specInternalPortAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecInternalPort]]): Either[Error,State] = {
override def specInternalPortAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecInternalPort]]) = {
val (_, node1, _) = node
val data = node1.data
for {
Expand All @@ -172,7 +172,7 @@ trait TypeExpressionAnalyzer
} yield a
}

override def specParamAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecParam]]): Either[Error,State] = {
override def specParamAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecParam]]) = {
val (_, node1, _) = node
val data = node1.data
for {
Expand All @@ -184,7 +184,7 @@ trait TypeExpressionAnalyzer
} yield a
}

override def specPortInstanceAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecPortInstance]]): Out = {
override def specPortInstanceAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecPortInstance]]) = {
val (_, node1, _) = node
val data = node1.data
data match {
Expand All @@ -197,7 +197,7 @@ trait TypeExpressionAnalyzer
}
}

override def specTlmChannelAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecTlmChannel]]): Either[Error,State] = {
override def specTlmChannelAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecTlmChannel]]) = {
def limit(a: Analysis, value: Ast.SpecTlmChannel.Limit) = {
val (_, e) = value
exprNode(a, e)
Expand Down
14 changes: 7 additions & 7 deletions compiler/lib/src/main/scala/analysis/Analyzers/UseAnalyzer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ trait UseAnalyzer extends TypeExpressionAnalyzer {
/** A use of a type definition */
def typeUse(a: Analysis, node: AstNode[Ast.TypeName], use: Name.Qualified): Result = default(a)

override def defComponentInstanceAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefComponentInstance]]): Either[Error,State] = {
override def defComponentInstanceAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.DefComponentInstance]]) = {
val (_, node1, _) = node
val data = node1.data
for {
Expand All @@ -33,7 +33,7 @@ trait UseAnalyzer extends TypeExpressionAnalyzer {
} yield a
}

override def exprDotNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprDot): Result = {
override def exprDotNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprDot) = {
def nameOpt(e: Ast.Expr, qualifier: List[Name.Unqualified]): Option[Name.Qualified] = {
e match {
case Ast.ExprIdent(id) => {
Expand All @@ -51,12 +51,12 @@ trait UseAnalyzer extends TypeExpressionAnalyzer {
}
}

override def exprIdentNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprIdent): Result = {
override def exprIdentNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprIdent) = {
val use = Name.Qualified(Nil, e.value)
constantUse(a, node, use)
}

override def specCompInstanceAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecCompInstance]]): Result = {
override def specCompInstanceAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecCompInstance]]) = {
val (_, node1, _) = node
val data = node1.data
qualIdentNode (componentInstanceUse) (a, data.instance)
Expand All @@ -83,7 +83,7 @@ trait UseAnalyzer extends TypeExpressionAnalyzer {
}
}

override def specPortInstanceAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecPortInstance]]): Out = {
override def specPortInstanceAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecPortInstance]]) = {
val (_, node, _) = aNode
val data = node.data
data match {
Expand Down Expand Up @@ -115,13 +115,13 @@ trait UseAnalyzer extends TypeExpressionAnalyzer {
}
}

override def specTopImportAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecTopImport]]): Result = {
override def specTopImportAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecTopImport]]) = {
val (_, node1, _) = node
val data = node1.data
qualIdentNode(topologyUse)(a, data.top)
}

override def typeNameQualIdentNode(a: Analysis, node: AstNode[Ast.TypeName], tn: Ast.TypeNameQualIdent): Result = {
override def typeNameQualIdentNode(a: Analysis, node: AstNode[Ast.TypeName], tn: Ast.TypeNameQualIdent) = {
val use = Name.Qualified.fromQualIdent(tn.name.data)
typeUse(a, node, use)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import fpp.compiler.util._
* and default values */
object CheckExprTypes extends UseAnalyzer {

override def constantUse(a: Analysis, node: AstNode[Ast.Expr], use: Name.Qualified): Result =
override def constantUse(a: Analysis, node: AstNode[Ast.Expr], use: Name.Qualified) =
visitUse(a, node)

override def defArrayAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefArray]]): Either[Error,State] = {
override def defArrayAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefArray]]) = {
val (_, node, _) = aNode
val data = node.data
for {
Expand All @@ -29,7 +29,7 @@ object CheckExprTypes extends UseAnalyzer {
} yield a
}

override def defConstantAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefConstant]]): Result = {
override def defConstantAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefConstant]]) = {
val (_, node,_) = aNode
if (!a.typeMap.contains(node.id)) {
val data = node.data
Expand All @@ -42,7 +42,7 @@ object CheckExprTypes extends UseAnalyzer {
else Right(a)
}

override def defEnumAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnum]]): Either[Error,State] = {
override def defEnumAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnum]]) = {
val (_, node, _) = aNode
val data = node.data
for {
Expand All @@ -60,7 +60,7 @@ object CheckExprTypes extends UseAnalyzer {
} yield a
}

override def defEnumConstantAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnumConstant]]): Either[Error,State] = {
override def defEnumConstantAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefEnumConstant]]) = {
val (_, node, _) = aNode
val data = node.data
for {
Expand All @@ -72,7 +72,7 @@ object CheckExprTypes extends UseAnalyzer {
yield a
}

override def defStructAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefStruct]]): Either[Error,State] = {
override def defStructAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefStruct]]) = {
val (_, node, _) = aNode
val data = node.data
for {
Expand All @@ -90,7 +90,7 @@ object CheckExprTypes extends UseAnalyzer {
} yield a
}

override def exprArrayNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprArray): Either[Error,Analysis] = {
override def exprArrayNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprArray) = {
val loc = Locations.get(node.id)
val emptyListError = SemanticError.EmptyArray(loc)
for {
Expand All @@ -99,7 +99,7 @@ object CheckExprTypes extends UseAnalyzer {
} yield a.assignType(node -> Type.AnonArray(Some(e.elts.size), t))
}

override def exprBinopNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprBinop): Either[Error,State] = {
override def exprBinopNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprBinop) = {
val loc = Locations.get(node.id)
for {
a <- super.exprBinopNode(a, node, e)
Expand All @@ -108,24 +108,24 @@ object CheckExprTypes extends UseAnalyzer {
} yield a.assignType(node -> t)
}

override def exprLiteralBoolNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralBool): Out =
override def exprLiteralBoolNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralBool) =
Right(a.assignType(node -> Type.Boolean))

override def exprLiteralFloatNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralFloat): Out =
override def exprLiteralFloatNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralFloat) =
Right(a.assignType(node -> Type.F64))

override def exprLiteralIntNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralInt): Out =
override def exprLiteralIntNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralInt) =
Right(a.assignType(node -> Type.Integer))

override def exprLiteralStringNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralString): Out =
override def exprLiteralStringNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprLiteralString) =
Right(a.assignType(node -> Type.String(None)))

override def exprParenNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprParen): Either[Error,Analysis] = {
override def exprParenNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprParen) = {
for (a <- super.exprParenNode(a, node, e))
yield a.assignType(node -> a.typeMap(e.e.id))
}

override def exprStructNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprStruct): Either[Error,State] = {
override def exprStructNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprStruct) = {
def getName(member: Ast.StructMember) = member.name
for {
_ <- Analysis.checkForDuplicateStructMember(getName)(e.members)
Expand All @@ -143,7 +143,7 @@ object CheckExprTypes extends UseAnalyzer {
}
}

override def exprUnopNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprUnop): Either[Error,Analysis] = {
override def exprUnopNode(a: Analysis, node: AstNode[Ast.Expr], e: Ast.ExprUnop) = {
val loc = Locations.get(node.id)
for {
a <- super.exprUnopNode(a, node, e)
Expand All @@ -154,7 +154,7 @@ object CheckExprTypes extends UseAnalyzer {
} yield a.assignType(node -> t)
}

override def specCommandAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecCommand]]): Either[Error,State] = {
override def specCommandAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecCommand]]) = {
val (_, node, _) = aNode
val data = node.data
for {
Expand All @@ -165,7 +165,7 @@ object CheckExprTypes extends UseAnalyzer {
yield a
}

override def specEventAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecEvent]]): Either[Error,State] = {
override def specEventAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecEvent]]) = {
val (_, node, _) = aNode
val data = node.data
for {
Expand All @@ -176,7 +176,7 @@ object CheckExprTypes extends UseAnalyzer {
yield a
}

override def specInitAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecInit]]): Either[Error,State] = {
override def specInitAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecInit]]) = {
val (_, node, _) = aNode
val data = node.data
for {
Expand All @@ -186,7 +186,7 @@ object CheckExprTypes extends UseAnalyzer {
yield a
}

override def specInternalPortAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecInternalPort]]): Either[Error,State] = {
override def specInternalPortAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecInternalPort]]) = {
val (_, node, _) = aNode
val data = node.data
for {
Expand All @@ -196,7 +196,7 @@ object CheckExprTypes extends UseAnalyzer {
yield a
}

override def specParamAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecParam]]): Either[Error,State] = {
override def specParamAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecParam]]) = {
val (_, node, _) = aNode
val data = node.data
def checkDefault (a: Analysis) (default: AstNode[Ast.Expr]) = {
Expand All @@ -215,7 +215,7 @@ object CheckExprTypes extends UseAnalyzer {
yield a
}

override def specPortInstanceAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecPortInstance]]): Out = {
override def specPortInstanceAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecPortInstance]]) = {
val (_, node, _) = aNode
val data = node.data
data match {
Expand All @@ -230,7 +230,7 @@ object CheckExprTypes extends UseAnalyzer {
}
}

override def specTlmChannelAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecTlmChannel]]): Either[Error,State] = {
override def specTlmChannelAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.SpecTlmChannel]]) = {
val (_, node, _) = aNode
val data = node.data
def checkLimitExpr (a: Analysis) (e: AstNode[Ast.Expr]): Result.Result[Unit] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ object CheckPortDefs
with ModuleAnalyzer
{

override def defPortAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefPort]]): Either[Error,State] = {
override def defPortAnnotatedNode(a: Analysis, aNode: Ast.Annotated[AstNode[Ast.DefPort]]) = {
val (_, node, _) = aNode
val data = node.data
for (_ <- Analysis.checkForDuplicateParameter(data.params))
Expand Down
Loading

0 comments on commit 7293985

Please sign in to comment.