1. 16 Aug, 2021 1 commit
  2. 29 Jul, 2021 1 commit
  3. 24 Jan, 2021 5 commits
    • Eric Myhre's avatar
      schema compiler: migrate compile tests, and drop schema2 (everything good is now migrated). · eed03b4c
      Eric Myhre authored
      Extracted a few last comment hunks that were useful and that's
      the end of it.
      
      The migrated tests only mostly pass (but, remember, we've been several
      commits in a row already where we're making checkpoints to keep this
      refactor managable, and CI is not full green across the board for
      some of them).  I've updated some of the error text assertions,
      but there's other breakage as well.  One is just other todos.
      Another is... It may be time to switch test libraries.  What go-wish
      (and transitively, go-cmp) is doing with `[]error` values is...
      not helpful.
      eed03b4c
    • Eric Myhre's avatar
      schema compiler: enum validation rules. · 6b5a471f
      Eric Myhre authored
      And I think this now ports all the rules we'd previously written
      against the attempted schema2 (the wrapper style) API.
      So I can now remove the rest of that in the next commit.
      
      It will soon be time to start updating all the gengo stuff to
      use this, including all of its tests.
      6b5a471f
    • Eric Myhre's avatar
      schema compiler: union validation rules. · ea79ea43
      Eric Myhre authored
      Also, shift some error message text towards a more consistent phrasing.
      ea79ea43
    • Eric Myhre's avatar
      schema compiler: union rules. · 6897bb3c
      Eric Myhre authored
      Commit to the strategy of having the first flunked rule for a type
      result in short-circuit skipping of subsequent rules.  It's simple,
      and it's sufficient.
      6897bb3c
    • Eric Myhre's avatar
      schema: beginning (re)implementation of validation rules. · fe935c9c
      Eric Myhre authored
      Carving out hunks of the schema2 implementation of them (which still
      hoped to use the dmt more directly) as I port them.
      
      As comments in the diff state: I had a hope here that I could make
      this relatively table-driven, which would increase legibility and
      make it easier to port these checks to other implementations as well.
      We'll... see how that goes; it's not easy to flatten.
      fe935c9c
  4. 25 Dec, 2020 1 commit
    • Daniel Martí's avatar
      all: rename schema.Kind to TypeKind, ipld.ReprKind to Kind · 2d7d25c4
      Daniel Martí authored
      As discussed on the issue thread, ipld.Kind and schema.TypeKind are more
      intuitive, closer to the spec wording, and just generally better in the
      long run.
      
      The changes are almost entirely automated via the commands below. Very
      minor changes were needed in some of the generators, and then gofmt.
      
      	sed -ri 's/\<Kind\(\)/TypeKind()/g' **/*.go
      	git checkout fluent # since it uses reflect.Value.Kind
      
      	sed -ri 's/\<Kind_/TypeKind_/g' **/*.go
      	sed -i 's/\<Kind\>/TypeKind/g' **/*.go
      	sed -i 's/ReprKind/Kind/g' **/*.go
      
      Plus manually undoing a few renames, as per Eric's review.
      
      Fixes #94.
      2d7d25c4
  5. 16 Dec, 2020 1 commit
    • Daniel Martí's avatar
      all: rewrite interfaces and APIs to support int64 · f6e9a891
      Daniel Martí authored
      We only supported representing Int nodes as Go's "int" builtin type.
      This is fine on 64-bit, but on 32-bit, it limited those node values to
      just 32 bits. This is a problem in practice, because it's reasonable to
      want more than 32 bits for integers.
      
      Moreover, this meant that IPLD would change behavior if built for a
      32-bit platform; it would not be able to decode large integers, for
      example, when in fact that was just a software limitation that 64-bit
      builds did not have.
      
      To fix this problem, consistently use int64 for AsInt and AssignInt.
      
      A lot more functions are part of this rewrite as well; mainly, those
      revolving around collections and iterating. Some might never need more
      than 32 bits in practice, but consistency and portability is preferred.
      Moreover, many are interfaces, and we want IPLD interfaces to be
      flexible, which will be important for ADLs.
      
      Below are some GNU sed lines which can be used to quickly update
      function signatures to use int64:
      
      	sed -ri 's/(func.* AsInt.*)\<int\>/\1int64/g' **/*.go
      	sed -ri 's/(func.* AssignInt.*)\<int\>/\1int64/g' **/*.go
      	sed -ri 's/(func.* Length.*)\<int\>/\1int64/g' **/*.go
      	sed -ri 's/(func.* LookupByIndex.*)\<int\>/\1int64/g' **/*.go
      	sed -ri 's/(func.* Next.*)\<int\>/\1int64/g' **/*.go
      	sed -ri 's/(func.* ValuePrototype.*)\<int\>/\1int64/g' **/*.go
      
      Note that the function bodies, as well as the code that calls said
      functions, may need to be manually updated with the integer type change.
      That cannot be automated, because it's possible that an automated fix
      would silently introduce potential overflows not being handled.
      
      Some TODOs and FIXMEs for overflow checks are removed, since we remove
      some now unnecessary int64->int conversions. On the other hand, the
      older codecs based on refmt need to gain some overflow check TODOs,
      since refmt uses ints. That is okay for now, since we'll phase out refmt
      pretty soon.
      
      While at it, update codectools to use int64 for token Length fields, so
      that it properly supports full IPLD integers without machine-dependent
      behavior and overflow checks. The budget integer is also updated to be
      int64, since the lengths it uses are now int64.
      
      Note that this refactor needed changes to the Go code generator as well
      as some of the tests, for the purpose of updating all the code.
      
      Finally, note that the code-generated iterator structs do not use int64
      fields internally, even though they must return int64 numbers to
      implement the interface. This is because they use the numeric fields to
      count up to a small finite amount (such as the number of fields in a Go
      struct), or up to the length of a map/slice. Neither of them can ever
      outgrow "int".
      
      Fixes #124.
      f6e9a891
  6. 04 Dec, 2020 1 commit