Skip to content

Commit 134fbf4

Browse files
remove unused forms
Summary: - `ExternalForm` and `ExtType` are not sent to eqWAlizer anymore and can be deleted Reviewed By: VLanvin Differential Revision: D60387724 fbshipit-source-id: 9fafabc80f6ee148ac9f9a189cf848272c0b351f
1 parent a142f4c commit 134fbf4

File tree

3 files changed

+14
-90
lines changed

3 files changed

+14
-90
lines changed

eqwalizer/src/main/scala/com/whatsapp/eqwalizer/Pipeline.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ object Pipeline {
2424
def checkForms(moduleName: String, options: Options = noOptions): List[InternalForm] = {
2525
import scala.collection.mutable.ListBuffer
2626

27-
val forms = Forms.load(moduleName).collect { case f: InternalForm => f }
27+
val forms = Forms.load(moduleName)
2828
val module = forms.collectFirst { case Module(m) => m }.get
2929
val erlFile = forms.collectFirst { case File(f, _) => f }.get
3030
val noCheckFuns = forms.collect { case f: EqwalizerNowarnFunction => (f.id, f.pos) }.toMap

eqwalizer/src/main/scala/com/whatsapp/eqwalizer/ast/ExternalTypes.scala

-58
This file was deleted.

eqwalizer/src/main/scala/com/whatsapp/eqwalizer/ast/Forms.scala

+13-31
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
package com.whatsapp.eqwalizer.ast
88

99
import com.whatsapp.eqwalizer.ast.Exprs.{Clause, Expr}
10-
import com.whatsapp.eqwalizer.ast.ExternalTypes._
1110
import com.whatsapp.eqwalizer.ast.InvalidDiagnostics.Invalid
1211
import com.whatsapp.eqwalizer.ast.Types._
1312
import com.whatsapp.eqwalizer.tc.TcDiagnostics.{BehaviourError, TypeError}
@@ -19,37 +18,20 @@ import scala.collection.immutable.TreeSeqMap
1918

2019
object Forms {
2120

22-
case class Module(name: String)(val pos: Pos) extends ExternalForm with InternalForm
23-
case class CompileExportAll()(val pos: Pos) extends ExternalForm
24-
case class Export(funs: List[Id])(val pos: Pos) extends ExternalForm with InternalForm
25-
case class Import(module: String, funs: List[Id])(val pos: Pos) extends ExternalForm with InternalForm
26-
case class ExportType(types: List[Id])(val pos: Pos) extends ExternalForm with InternalForm
27-
case class FunDecl(id: Id, clauses: List[Clause])(val pos: Pos) extends ExternalForm with InternalForm
28-
case class File(file: String, start: Int)(val pos: Pos) extends ExternalForm with InternalForm
21+
case class Module(name: String)(val pos: Pos) extends InternalForm
22+
case class Export(funs: List[Id])(val pos: Pos) extends InternalForm
23+
case class Import(module: String, funs: List[Id])(val pos: Pos) extends InternalForm
24+
case class ExportType(types: List[Id])(val pos: Pos) extends InternalForm
25+
case class FunDecl(id: Id, clauses: List[Clause])(val pos: Pos) extends InternalForm
26+
case class File(file: String, start: Int)(val pos: Pos) extends InternalForm
2927
case class Fixme(comment: TextRange, suppression: TextRange, isIgnore: Boolean)
30-
case class ElpMetadata(fixmes: List[Fixme])(val pos: Pos) extends ExternalForm with InternalForm
31-
case class Behaviour(name: String)(val pos: Pos) extends ExternalForm with InternalForm
32-
case class EqwalizerNowarnFunction(id: Id)(val pos: Pos) extends ExternalForm with InternalForm
33-
case class EqwalizerUnlimitedRefinement(id: Id)(val pos: Pos) extends ExternalForm with InternalForm
34-
35-
/** used for analyses only, should not affect the behavior of the type checker
36-
*/
37-
case class TypingAttribute(names: List[String])(val pos: Pos) extends ExternalForm
28+
case class ElpMetadata(fixmes: List[Fixme])(val pos: Pos) extends InternalForm
29+
case class Behaviour(name: String)(val pos: Pos) extends InternalForm
30+
case class EqwalizerNowarnFunction(id: Id)(val pos: Pos) extends InternalForm
31+
case class EqwalizerUnlimitedRefinement(id: Id)(val pos: Pos) extends InternalForm
3832

3933
sealed trait Form
4034

41-
sealed trait ExternalForm extends Form { val pos: Pos }
42-
case class ExternalTypeDecl(id: Id, params: List[String], body: ExtType, file: Option[String])(val pos: Pos)
43-
extends ExternalForm
44-
case class ExternalOpaqueDecl(id: Id, params: List[String], body: ExtType, file: Option[String])(val pos: Pos)
45-
extends ExternalForm
46-
case class ExternalFunSpec(id: Id, types: List[ConstrainedFunType])(val pos: Pos) extends ExternalForm
47-
case class ExternalCallback(id: Id, types: List[ConstrainedFunType])(val pos: Pos) extends ExternalForm
48-
case class ExternalOptionalCallbacks(ids: List[Id])(val pos: Pos) extends ExternalForm
49-
case class ExternalRecDecl(name: String, fields: List[ExternalRecField], file: Option[String])(val pos: Pos)
50-
extends ExternalForm
51-
case class ExternalRecField(name: String, tp: Option[ExtType], defaultValue: Option[Expr])
52-
5335
sealed trait InternalForm extends Form { val pos: Pos }
5436
case class FunSpec(id: Id, ty: FunType)(val pos: Pos) extends InternalForm
5537
case class OverloadedFunSpec(id: Id, tys: List[FunType])(val pos: Pos) extends InternalForm
@@ -81,12 +63,12 @@ object Forms {
8163
case class FuncDecl(id: Id, errors: List[TypeError])(val pos: Pos) extends InternalForm
8264
case class MisBehaviour(te: BehaviourError)(val pos: Pos) extends InternalForm
8365

84-
def load(module: String): List[ExternalForm] = {
66+
def load(module: String): List[InternalForm] = {
8567
val bytes = Ipc.getAstBytes(module, Ipc.ConvertedForms).get
86-
readFromArray[List[ExternalForm]](bytes)
68+
readFromArray[List[InternalForm]](bytes)
8769
}
8870

89-
implicit val codec: JsonValueCodec[List[ExternalForm]] = JsonCodecMaker.make(
71+
implicit val codec: JsonValueCodec[List[InternalForm]] = JsonCodecMaker.make(
9072
CodecMakerConfig.withAllowRecursiveTypes(true).withDiscriminatorFieldName(None).withFieldNameMapper {
9173
case "pos" => "location"
9274
case "mod" => "module"

0 commit comments

Comments
 (0)