Skip to content

block or non-block ? I don't understand #2613

@igouy

Description

@igouy
example.toit:31:9: error: Argument mismatch for 'List.sort'
Argument '--in-place' was passed with block type, but must be non-block
  items.sort --in-place=: | a b | a[1] < b[1] ? 1 : -1
        ^~~~
Compilation failed

;but here =: seems required;

/opt/tmp/started$ /opt/src/toit/bin/toit.compile -o example example.toit
example.toit:36:38: error: Argument mismatch for 'Map.get'
Method does not take an unnamed block argument, but one was provided
Argument '--if-absent' was passed with non-block type, but must be block
  return (base_counts code.size seq).get code 
                                     ^~~
Compilation failed

By trial and error I figured out how to make it compile but it seems like both situations are the same?

example.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions