Git Product home page Git Product logo

Comments (4)

zerbina avatar zerbina commented on July 19, 2024

I believe you meant set[int8] rather than seq[int8]? If so, could you update the title and body?

As as an aside, you can also use 1'i8 instead of 1.int8 (it's a bit shorter).

from nimskull.

blackmius avatar blackmius commented on July 19, 2024

sure seq -> set, sorry for confusion

from nimskull.

saem avatar saem commented on July 19, 2024

The examples in the body are still wrong, as in those should definitely be type errors; since you're attempting to assign a set to a sequence. The work around is confusing, is there a converter at play there because it would not work?

from nimskull.

mrgaturus avatar mrgaturus commented on July 19, 2024

this is more related to integer literals inference which most time inference to int and don't respect other int/uint types.
other error examples:

const
  my_array: array[4, int8] = [1, 1, 1, 1]
  my_tuple: tuple[x, y: int8] = (1, 1)

var
  x: int32
  y: int32

x = 1 shl x
y = 1 shr y
Error: type mismatch: got 'array[0..3, int]' for '[1, 1, 1, 1]' but expected 'array[0..3, int8]'
Error: type mismatch: got '(int, int)' for '(1, 1)' but expected 'tuple[x: int8, y: int8]'
Error: type mismatch: got 'int' for '1 shl x' but expected 'int32'
Error: type mismatch: got 'int' for '1 shr y' but expected 'int32'

from nimskull.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.