question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Template level "spread operator" missing type-information required for disambiguation of field names

See original GitHub issue

I have a piece of code that works in 1.8, but throws errors on 1.9. It seems that let MyType{..} = var loses some type-information required for disambiguation of field names.

Here is a minimum example

module SpreadOperator where

data DataTypeOne = DataTypeOne with
  partyName : Party
    deriving (Eq, Show)

data DataTypeTwo = DataTypeTwo with
  partyName : Party
    deriving (Eq, Show)

template ImportTest with
    import_var: DataTypeOne
  where
    let DataTypeOne{..} = import_var
    signatory partyName

The error is:

~/tmp/myproject/daml/SpreadOperator.daml:15:15: error:
    Ambiguous occurrence 'partyName'
    It could refer to
       either the field 'partyName',
              defined at ~/tmp/myproject/daml/SpreadOperator.daml:8:3
           or the field 'partyName',
              defined at ~/tmp/myproject/daml/SpreadOperator.daml:4:3

I would expect that let DataTypeOne{..} = import_var has enough type information do disambiguate.

The issue persists in Daml Connect 1.10.

@garyverhaegen-da mentioned that there was a change to template-level bindings that might be causing it.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
garyverhaegen-dacommented, Feb 23, 2021

Note that the issue persists without the spread operator:

module Main where

data DataTypeOne = DataTypeOne with
  partyName : Party
    deriving (Eq, Show)

data DataTypeTwo = DataTypeTwo with
  partyName : Party
    deriving (Eq, Show)

template ImportTest with
    import_var: DataTypeOne
  where
    let DataTypeOne{partyName} = import_var
    signatory partyName

still fails with the same error.

0reactions
darko-dacommented, Feb 24, 2021

Definitely not urgent as one can easily not use that feature.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript Error and the spread operator arising from ...props?
From what I understand this function accepts a spread operator, so that is meant to say it accepts an object / array with...
Read more >
Releases · google/closure-compiler Wiki - GitHub
Introduction. Here's a list of recent releases of Closure Compiler. See the README for how to obtain the latest release. We also update...
Read more >
Programming in Standard ML
inferring the missing type information based on context. For example, there is no need to give a type to the variable s in...
Read more >
The jOOQ Release Note History
The operator is currently emulated using SQL/XML or SQL/JSON. The resulting documents are parsed again when fetching them from JDBC. Future versions will...
Read more >
C++ Core Guidelines - GitHub Pages
If you need a tutorial for some given level of experience, ... For example, many examples are language-technical and use names like f ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found