Skip to content

[#65] Resolve issue with colliding `DocItemPosition`s

Konstantin Ivanov requested to merge martoon/#65-complex-doc-pos into master

Description

Problem: currenty set of doc item positions is one-demensional, one only provides a natural number according to the position of given property in the resulting document. Naturally, this number must be unique for each doc item.

However, recently we encountered an unexpected scenario of making a project over multiple different projects with contracts (which was also discouraged by our new approach to errors). Now there are problems in such scenarios because different projects with contracts may declare doc items having the same position and attempt to depend on several such projects this will lead to collision (producing compile-time error).

Solution: make set of doc item positions two-dimensional, another dimension will stand for contract identifier: Pos x ContractId

Because it is not possible to define a total order on contract identifiers sanely (they don't know about each other), we define a partial order saying that there is Common identifier for doc items defined in Morley and other libraries, and also contract-specific identifiers. Order between contract-specific identifiers does not matter because different identifiers should never appear within the same contract documentation.

Related issue(s)

Resolves #65 (closed).

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
    • I updated the changelog if my changes are externally visible.

Stylistic guide (mandatory)

Edited by Konstantin Ivanov

Merge request reports