关于elixir:elixir-0078-elixir-版本升级的历程111-112

4次阅读

共计 638 个字符,预计需要花费 2 分钟才能阅读完成。

想平常一样关上 github,发现我最喜爱的编程语言 elixir 公布了新的版本。立马下载安装,没想到一运行公司的我的项目,爆了一堆谬误。

1

首先看到的是:

warning: ^^^ is deprecated. It is typically used as xor but it has the wrong precedence, use Bitwise.bxor/2 instead

查了一下 Changelog,原来这个函数曾经被淘汰了,像提醒里说的那样改为 Bitwise.bxor/2 就能够了。

2

而后 elixir 1.12 版本修改了一个对于 behaviour 的 bug。之前如果某个 callback 的实现函数没有标注 @impl true 的话是不会有正告的。当初会报:

warning: module attribute @impl was not set for function xxx/2 callback (specified in XXX). This either means you forgot to add the "@impl true" annotation before the definition or that you are accidentally overriding this callback

咱们把 @impl true 在对应函数下面加上就能够了。

3

最初是 format 的变动。在 1.12 版本中不再容许字符串本义中蕴含换行,例如

"abc#{d}e"

在旧版本中是合格的,在新版中则会被强制 format 为:

"abc#{d}e"

end

就这样,一次欢快的降级就实现了。

正文完
 0