@@ -184,7 +184,7 @@ Here’s the definition of the `mapImpl` macro, which takes quoted types and exp
184184 var i = 0
185185 val xs = ~arr
186186 var len = xs.length
187- val ys = new Array[~u]
187+ val ys = new Array[~u](len)
188188 while (i < len) {
189189 ys(i) = ~op(’(xs(i)))
190190 i += 1
@@ -212,7 +212,7 @@ Here’s an application of `map` and how it rewrites to optimized code:
212212 var i = 0
213213 val xs = ~’($this)
214214 var len = xs.length
215- val ys = new Array[~’[Int]]
215+ val ys = new Array[~’[Int]](len)
216216 while (i < len) {
217217 ys(i) = ~(’(f)(’(xs(i))))
218218 i += 1
@@ -229,7 +229,7 @@ Here’s an application of `map` and how it rewrites to optimized code:
229229 var i = 0
230230 val xs = $this
231231 var len = xs.length
232- val ys = new Array[Int]
232+ val ys = new Array[Int](len)
233233 while (i < len) {
234234 ys(i) = xs(i) + 1
235235 i += 1
@@ -245,7 +245,7 @@ Here’s an application of `map` and how it rewrites to optimized code:
245245 var i = 0
246246 val xs = $this
247247 var len = xs.length
248- val ys = new Array[Int]
248+ val ys = new Array[Int](len)
249249 while (i < len) {
250250 ys(i) = xs(i) + 1
251251 i += 1
@@ -291,7 +291,7 @@ applicable without the global value exception. But in the example as
291291given this does not hold since both ` assert ` and ` program ` call
292292` assertImpl ` with a splice but no quote.
293293
294- However, one can could argue that the example is really missing
294+ However, one could argue that the example is really missing
295295an important aspect: The macro library has to be compiled in a phase
296296prior to the program using it, but in the code above, macro
297297and program are defined together. A more accurate view of
0 commit comments