Skip to content
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

Expose conversion from Ast.Type to iface.Type #3511

Merged
merged 2 commits into from
Nov 18, 2019
Merged

Conversation

cocreature
Copy link
Contributor

This allows me to get rid of the duplicated conversion logic for DAML
script. The reason for why I can’t use the higher level APIs provided
by the interface reader is that the type of the script identifier can
be a function which is not serializable and therefore does not show up
in the interface. However, I only want to translate the type of the
argument of that function which is serializable.

Pull Request Checklist

  • Read and understand the contribution guidelines
  • Include appropriate tests
  • Set a descriptive title and thorough description
  • Add a reference to the issue this PR will solve, if appropriate
  • Add a line to the release notes, if appropriate
  • Normal production system change, include purpose of change in description

NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with /AzurePipelines run to
trigger the build.

@@ -195,7 +195,7 @@ object InterfaceReader {
: InterfaceReaderError \/ ImmArraySeq[(Ref.Name, Type)] =
fields.toSeq traverseU { case (fieldName, typ) => type_(ctx, typ).map(x => fieldName -> x) }

private def type_(
def type_(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@S11001001, @cocreature: what would be a bit more descriptive name for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about toIfaceType?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to toIfaceType. Happy to change it to something else, I don’t care much for the name here.

This allows me to get rid of the duplicated conversion logic for DAML
script. The reason for why I can’t use the higher level APIs provided
by the interface reader is that the type of the script identifier can
be a function which is not serializable and therefore does not show up
in the interface. However, I only want to translate the type of the
argument of that function which is serializable.
Copy link
Contributor

@S11001001 S11001001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to dismiss after applying.

…e/reader/InterfaceReader.scala

Co-Authored-By: Stephen Compall <stephen.compall@daml.com>
@mergify mergify bot merged commit 6b53680 into master Nov 18, 2019
@mergify mergify bot deleted the expose-iface-type branch November 18, 2019 18:22
bame-da pushed a commit that referenced this pull request Nov 19, 2019
* Expose conversion from Ast.Type to iface.Type

This allows me to get rid of the duplicated conversion logic for DAML
script. The reason for why I can’t use the higher level APIs provided
by the interface reader is that the type of the script identifier can
be a function which is not serializable and therefore does not show up
in the interface. However, I only want to translate the type of the
argument of that function which is serializable.

* Update daml-lf/interface/src/main/scala/com/digitalasset/daml/lf/iface/reader/InterfaceReader.scala

Co-Authored-By: Stephen Compall <stephen.compall@daml.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants