The compiler is unable to type-check this expression in reasonable time; try breaking up the express

简介: The compiler is unable to type-check this expression in reasonable time; try breaking up the express

/Users/jiaguoshang/Downloads/OnlineShopDemo-master/SwiftOnlineShopDemo/SwiftOnlineShopDemo/ViewController/CFClassificationController/CFClassificationController.swift:66:53:

The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions

This error generally occurs when a single expression is doing a lot of things. So compiler tells you to break it to sub-expressions.

一个单个的描述(判断条件)做了太多的事情。

老程序猿经常用这样语句来显示自己的水平多高,代码多精简。但是对有些程序猿理解不是那么一目了然。现代语言(js,swift,Kotlin),强类型的语言。可以做到言简意赅,类型推导,利于理解,不是增加理解的难度。 swift禁止这种耍大牌,直接给你编译不过。解决很简单:就是把它分成几个小语句替换了就可以了,也就是语句拆分。

        let y = rect.origin.y - leftTableView.mj_offsetY
        let h = leftTableView.mj_h - 44 * 3 - 1
        if y >= h {
            
            let contentOffset_y = leftTableView.mj_offsetY + 44 * 3
            
            if total_offset - leftTableView.mj_offsetY < 44 * 3 {
                //判断ios 11直接设置偏移无效,我也没弄懂,必须延时才有效
                
                DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
                    self.leftTableView.setContentOffset(CGPoint(x: 0, y: total_offset), animated: true)
                }

            }
            else
            {
                DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
                    self.leftTableView.setContentOffset(CGPoint(x: 0, y: contentOffset_y), animated: true)
                }
            }
        }


目录
相关文章
|
4月前
|
Python
ERROR: Could not find a version that satisfies the requirement thop (from versions: none) ERROR: No
这篇文章介绍了在尝试安装`thop`包时遇到的"No matching distribution found"错误,并提供了通过直接从GitHub源码安装`thop`的解决方法。
ERROR: Could not find a version that satisfies the requirement thop (from versions: none) ERROR: No
|
SQL Java 数据库连接
sql injection violation, syntax error: syntax error, error in :‘**‘expect IDENTIFIER, actual IDENTIF
sql injection violation, syntax error: syntax error, error in :‘**‘expect IDENTIFIER, actual IDENTIF
220 0
|
Linux
ERROR: 2 matches found based on name: network product-server_default is ambiguous
ERROR: 2 matches found based on name: network product-server_default is ambiguous
166 0
解决办法:Type safety: The expression of type List needs unchecked conversion to conform
解决办法:Type safety: The expression of type List needs unchecked conversion to conform
334 0
|
网络协议 关系型数据库 Linux
onfigure: error: no acceptable C compiler found in $PATH See `config.log' for more details 问题解决
onfigure: error: no acceptable C compiler found in $PATH See `config.log' for more details 问题解决
189 0
jinja2: Can't perform this operation for unregistered loader type
jinja2: Can't perform this operation for unregistered loader type
143 0
expected &#39;(&#39;, found &#39;IDENT&#39;
方法A放到了方法B内了,挪出即可。
1221 0
Multiple network matches found for name 'selfservice', use an ID to be more specific.报错
今天正在做openstack实例时输入neutron subnet-create --name selfservice   --dns-nameserver 114.114.114.114 --gateway 192.
1476 0