8000 fix for dealiasing extractor by edwardpeters · Pull Request #555 · finos/morphir-scala · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix for dealiasing extractor #555

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

Merged
merged 2 commits into from
Mar 22, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ object Extractors {
tpe match {
case NativeRef(_, _) => None
case Type.Reference(_, typeName, typeArgs) =>
val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName)
val lookedUp = dists.lookupTypeDefinition(typeName.packagePath, typeName.modulePath, typeName.localName)
lookedUp match {
case Right(T.Specification.TypeAliasSpecification(typeParams, expr)) =>
case Right(T.Definition.TypeAlias(typeParams, expr)) =>
val newBindings = typeParams.zip(typeArgs).toMap
Some(Utils.applyBindings(expr, newBindings))
case _ => None // Missing name, but failing extractors cause problems
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ object TypeCheckerTests extends MorphirBaseSpec {
irFilePath <- ZIO.succeed(os.pwd / "examples" / "morphir-elm-projects" / "evaluator-tests" / "morphir-ir.json")
_ <- Console.printLine(s"Loading distribution from $irFilePath")
dist <- EvaluationLibrary.loadDistributionFromFileZIO(irFilePath.toString)

} yield MorphirRuntime.quick(dist))

val typeCheckerLayer: ZLayer[Any, Throwable, TypeChecker] =
ZLayer(for {
irFilePath <- ZIO.succeed(os.pwd / "examples" / "morphir-elm-projects" / "evaluator-tests" / "morphir-ir.json")
_ <- Console.printLine(s"Loading distribution from $irFilePath")
dist <- EvaluationLibrary.loadDistributionFromFileZIO(irFilePath.toString)
} yield new TypeChecker(Distributions(dist)))
unitTestDist <-
EvaluationLibrary.loadDistributionFromFileZIO("morphir-elm/sdks/morphir-unit-test/morphir-ir.json")
} yield new TypeChecker(Distributions(dist, unitTestDist)))

def testTypeConforms(tpe1: UType, tpe2: UType)(expectedErrors: Int): ZIO[TypeChecker, Throwable, TestResult] =
ZIO.serviceWithZIO[TypeChecker] { checker =>
Expand Down
0