mirror of
https://github.com/fluencelabs/aqua.git
synced 2024-12-04 14:40:17 +00:00
fix(compiler): Fix search for one element cycles (#797)
This commit is contained in:
parent
0f9c40e9d1
commit
33ab33d4c8
@ -40,12 +40,10 @@ object Linker extends Logging {
|
|||||||
case path :: otherPaths =>
|
case path :: otherPaths =>
|
||||||
val pathDeps = deps.get(path.last).toList.flatten
|
val pathDeps = deps.get(path.last).toList.flatten
|
||||||
val cycles = pathDeps.flatMap(dep =>
|
val cycles = pathDeps.flatMap(dep =>
|
||||||
NonEmptyChain
|
NonEmptyChain.fromChain(
|
||||||
.fromChain(
|
// This is slow
|
||||||
// This is slow
|
path.toChain.dropWhile(_ != dep)
|
||||||
path.toChain.dropWhile(_ != dep)
|
)
|
||||||
)
|
|
||||||
.toList
|
|
||||||
)
|
)
|
||||||
val newPaths = pathDeps
|
val newPaths = pathDeps
|
||||||
.filterNot(visited.contains)
|
.filterNot(visited.contains)
|
||||||
@ -62,7 +60,7 @@ object Linker extends Logging {
|
|||||||
.flatMap(m =>
|
.flatMap(m =>
|
||||||
findCycles(
|
findCycles(
|
||||||
paths = NonEmptyChain.one(m.id) :: Nil,
|
paths = NonEmptyChain.one(m.id) :: Nil,
|
||||||
visited = Set.empty,
|
visited = Set(m.id),
|
||||||
result = List.empty
|
result = List.empty
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user