syntax: var assignment can bypass casted type
authorJean Privat <jean@pryen.org>
Fri, 19 Jun 2009 15:56:45 +0000 (11:56 -0400)
committerJean Privat <jean@pryen.org>
Wed, 24 Jun 2009 19:47:48 +0000 (15:47 -0400)
commitb1679897f82ef107c3b0461bc0f08d8f8e2d36c3
treec3ff1afd1c82c2cc751a46a898e31d2317c6f2ef
parentca0cea9fae81c96b4d9b3b11e7ef40c5b44f720b
syntax: var assignment can bypass casted type

If rvalue is conform with casted type then
  variable remains casted
else if rvalue is conform with base type then
  # It is the novelty
  variable is (up)casted to its base type
else error

Example:
  var x: T
  x.u_only_method # error
  assert x isa U
  x.u_only_method # ok
  x = a_t # ok
  x.u_only_method # error

Signed-off-by: Jean Privat <jean@pryen.org>
src/syntax/typing.nit
tests/base_isa_cast2.nit [new file with mode: 0644]
tests/sav/base_isa_cast2.sav [new file with mode: 0644]
tests/sav/base_isa_cast2_alt1.sav [new file with mode: 0644]
tests/sav/base_isa_cast2_alt2.sav [new file with mode: 0644]
tests/sav/base_isa_cast2_alt3.sav [new file with mode: 0644]
tests/sav/base_isa_cast2_alt4.sav [new file with mode: 0644]
tests/sav/base_isa_cast2_alt5.sav [new file with mode: 0644]
tests/sav/base_isa_cast2_alt6.sav [new file with mode: 0644]
tests/sav/base_isa_cast2_alt7.sav [new file with mode: 0644]
tests/sav/base_isa_cast2_alt8.sav [new file with mode: 0644]