microsoft/BosqueLanguage

Structured declaration & assignment fails

brakmic opened this issue · 3 comments

Describe the bug

This example from language docs can't be compiled.

namespace NSMain;

entrypoint function main(): Int {
  {f=let x, g=@[let y, let z]} = {f=1, g=@[2, 3]};
  return y;
}

It fails with: Parse error -- ["declarations.bsq",6,"Literal match is not allowed"]

Minor syntax changes here too. I'll do a quick update in the docs as well.

entrypoint function main(): Int {
{f=let x, g=[let y, let z]} = {f=1, g=[2, 3]};
return y;
}

Minor syntax changes here too. I'll do a quick update in the docs as well.

entrypoint function main(): Int {
{f=let x, g=[let y, let z]} = {f=1, g=[2, 3]};
return y;
}

Awesome! Many thanks!

@mrkmarron

I'm getting this C++ compiler error:

Error -- Error: Command failed: clang++ -g -DBDEBUG -std=c++17 -o declarations /Users/brakmic/projects/BosqueLanguage/impl/bin/scratch/cpp/*.cpp
/Users/brakmic/projects/BosqueLanguage/impl/bin/scratch/cpp/main.cpp:37:18: warning: ISO C++ does not allow indirection on operand of type 'BSQ::Value' (aka 'void *') [-Wvoid-ptr-dereference]
    _tmp_6I36I = *_tmp_0I33I.atFixed<MIRPropertyEnum::g>();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/brakmic/projects/BosqueLanguage/impl/bin/scratch/cpp/main.cpp:37:16: error: no viable overloaded '='
    _tmp_6I36I = *_tmp_0I33I.atFixed<MIRPropertyEnum::g>();
    ~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/brakmic/projects/BosqueLanguage/impl/bin/scratch/cpp/bsqcustom/../bsqvalue.h:746:15: note: candidate function not viable: cannot convert argument of incomplete type 'void' to 'const BSQ::BSQTuple' for 1st argument
    BSQTuple& operator=(const BSQTuple& src)
              ^
/Users/brakmic/projects/BosqueLanguage/impl/bin/scratch/cpp/bsqcustom/../bsqvalue.h:759:15: note: candidate function not viable: cannot convert argument of incomplete type 'void' to 'BSQ::BSQTuple' for 1st argument
    BSQTuple& operator=(BSQTuple&& src)
              ^
/Users/brakmic/projects/BosqueLanguage/impl/bin/scratch/cpp/main.cpp:40:18: warning: ISO C++ does not allow indirection on operand of type 'BSQ::Value' (aka 'void *') [-Wvoid-ptr-dereference]
    _tmp_8I39I = *_tmp_0I33I.atFixed<MIRPropertyEnum::g>();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/brakmic/projects/BosqueLanguage/impl/bin/scratch/cpp/main.cpp:40:16: error: no viable overloaded '='
    _tmp_8I39I = *_tmp_0I33I.atFixed<MIRPropertyEnum::g>();
    ~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/brakmic/projects/BosqueLanguage/impl/bin/scratch/cpp/bsqcustom/../bsqvalue.h:746:15: note: candidate function not viable: cannot convert argument of incomplete type 'void' to 'const BSQ::BSQTuple' for 1st argument
    BSQTuple& operator=(const BSQTuple& src)
              ^
/Users/brakmic/projects/BosqueLanguage/impl/bin/scratch/cpp/bsqcustom/../bsqvalue.h:759:15: note: candidate function not viable: cannot convert argument of incomplete type 'void' to 'BSQ::BSQTuple' for 1st argument
    BSQTuple& operator=(BSQTuple&& src)
              ^
2 warnings and 2 errors generated.