nim-lang / Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
https://nim-lang.org
Other
16.54k stars 1.47k forks source link

[urgent] [CI] broke recently for all PRs: `tests/assign/tassign.nim` broke #9339

Closed timotheecour closed 6 years ago

timotheecour commented 6 years ago

eg: https://travis-ci.org/nim-lang/Nim/jobs/440787636 for a PR https://github.com/nim-lang/Nim/pull/9336 that only touches doc/manual.rst

testament/tester '--nim:compiler/nim ' cat assign 
FAIL: tassign.nim C
Test "tests/assign/tassign.nim" in category "assign"
Failure: reOutputsDiffer
Expected:
TEMP=C:\Programs\xyz\bin
8 5 0 0
pre test a:test b:1 c:2 haha:3
assignment test a:test b:1 c:2 haha:3
Concrete '='
Concrete '='
Concrete '='
Concrete '='
Concrete '='
GenericT[T] '=' int
GenericT[T] '=' float
GenericT[T] '=' float
GenericT[T] '=' float
GenericT[T] '=' string
GenericT[T] '=' int8
GenericT[T] '=' bool
GenericT[T] '=' bool
GenericT[T] '=' bool
GenericT[T] '=' bool
Gotten:
TEMP=C:\Programs\xyz\bin
8 5 0 0
pre test a:test b:1 c:2 haha:3
assignment test a:test b:1 c:2 haha:3

even if we fix this, how could it have passed through CI's testing ?

EDIT I'm suspecting https://github.com/nim-lang/Nim/pull/9318 since it last touched tests/assign/tassign.nim but how come the CI was green for that PR? we shouldn't close this issue until we figure out root cause /cc @narimiran @araq

LemonBoy commented 6 years ago

It was @Araq's last couple of commits that broke the CI and were directly pushed to devel

narimiran commented 6 years ago

I'm suspecting #9318 since it last touched tests/assign/tassign.nim but how come the CI was green for that PR?

After that file was modified, the tests were run for six times in that PR: all six times there were no problems with that file.


EDIT: Building the latest Nim devel and running tests/assign/tassign.nim now produces this unexpected result.

This part:

import typetraits
block toverload_asgn:
  type
    Concrete = object
      a, b: string

  proc `=`(d: var Concrete; src: Concrete) =
    shallowCopy(d.a, src.a)
    shallowCopy(d.b, src.b)
    echo "Concrete '='"

  var x, y: array[0..2, Concrete]
  var cA, cB: Concrete

  var cATup, cBTup: tuple[x: int, ha: Concrete]

  x = y
  cA = cB
  cATup = cBTup

  type
    GenericT[T] = object
      a, b: T

  proc `=`[T](d: var GenericT[T]; src: GenericT[T]) =
    shallowCopy(d.a, src.a)
    shallowCopy(d.b, src.b)
    echo "GenericT[T] '=' ", type(T).name

  var ag: GenericT[int]
  var bg: GenericT[int]

  ag = bg

  var xg, yg: array[0..2, GenericT[float]]
  var cAg, cBg: GenericT[string]

  var cATupg, cBTupg: tuple[x: int, ha: GenericT[int8]]

  xg = yg
  cAg = cBg
  cATupg = cBTupg

  var caSeqg, cbSeqg: seq[GenericT[bool]]
  newSeq(cbSeqg, 4)
  caSeqg = cbSeqg

  when false:
    type
      Foo = object
        case b: bool
        of false: xx: GenericT[int]
        of true: yy: bool

    var
      a, b: Foo
    a = b

used to produce:

Concrete '='
Concrete '='
Concrete '='
Concrete '='
Concrete '='
GenericT[T] '=' int
GenericT[T] '=' float
GenericT[T] '=' float
GenericT[T] '=' float
GenericT[T] '=' string
GenericT[T] '=' int8
GenericT[T] '=' bool
GenericT[T] '=' bool
GenericT[T] '=' bool
GenericT[T] '=' bool

but now there's no output.

Araq commented 6 years ago

but now there's no output.

Sorry, my move optimizations now optimize away all the assignments...

timotheecour commented 6 years ago

ref: https://github.com/nim-lang/Nim/commit/1475697fbf0b7604d805e5c11467695c0c82512c but unclear to me whether it's a proper fix or temporary workaround (in which case should we re-open?)

I'm disabling this section of the test... it's hard to fix, the compiler is way too smart/aggressive (gitter)