summary refs log tree commit diff stats
path: root/tests/discard/tneedsdiscard_in_for.nim
blob: 5658f4ba2e2bdfe5053c680f642376cab0317335 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
discard """
  line: 22
  errormsg: '''expression 'premultiply(app.gradient[i])' is of type 'Rgba8' and has to be discarded'''
"""

# bug #9076
type
  Rgba8 = object

proc premultiply*(c: var Rgba8): var Rgba8 =
  discard

type
  App = ref object
    gradient: seq[Rgba8]

method onDraw(app: App) {.base.} =
  var
    width  = 100'f64

  for i in 0..<width.int:
    app.gradient[i].premultiply()