mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-23 21:10:54 +00:00
The PR branch had merge conflicts with `devel` due to a major compiler refactoring that extracted type definitions from `compiler/ast.nim` into a new `compiler/astdef.nim` file. ## Changes - Resolved conflict in `compiler/ast.nim` by accepting `devel`'s refactored structure - Merged 763 commits from `devel` branch (commit range: `ce6a345..b3273e7`) - Preserved original PR changes removing deprecated symbols from `lib/core/macros.nim` The core PR functionality (removal of deprecated macros API since v0.18.1) remains intact while incorporating the upstream AST refactoring. <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
52 lines
1.1 KiB
Nim
52 lines
1.1 KiB
Nim
discard """
|
|
matrix: "--mm:refc; --mm:orc"
|
|
targets: "c cpp js"
|
|
disabled: "osx"
|
|
"""
|
|
import std/assertions
|
|
# TODO: in future work move existing arithmetic tests (tests/arithm/*) into this file
|
|
# FYI https://github.com/nim-lang/Nim/pull/17767
|
|
|
|
template main =
|
|
# put all arithmetic tests
|
|
|
|
block tshr:
|
|
block: # Signed types
|
|
let
|
|
a1 = -3
|
|
a2 = -2
|
|
b1 = -4'i8
|
|
b2 = 1'i8
|
|
c1 = -5'i16
|
|
c2 = 1'i16
|
|
d1 = -7i32
|
|
d2 = 1'i32
|
|
e1 = -9'i64
|
|
e2 = 1'i64
|
|
doAssert a1 shr a2 == -1
|
|
doAssert b1 shr b2 == -2
|
|
doAssert c1 shr c2 == -3
|
|
doAssert d1 shr d2 == -4
|
|
doAssert e1 shr e2 == -5
|
|
|
|
block: # Unsigned types
|
|
let
|
|
a1 = 3'u
|
|
a2 = 2'u
|
|
b1 = 2'u8
|
|
b2 = 1'u8
|
|
c1 = 5'u16
|
|
c2 = 1'u16
|
|
d1 = 6'u32
|
|
d2 = 1'u32
|
|
e1 = 8'u64
|
|
e2 = 1'u64
|
|
doAssert a1 shr a2 == 0
|
|
doAssert b1 shr b2 == 1
|
|
doAssert c1 shr c2 == 2
|
|
doAssert d1 shr d2 == 3
|
|
doAssert e1 shr e2 == 4
|
|
|
|
static: main()
|
|
main()
|