File tree 2 files changed +13
-2
lines changed
compiler/src/dotty/tools/dotc/core
2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -1690,14 +1690,20 @@ object Types {
1690
1690
* is returned. If no function type is found, Any is returned.
1691
1691
*/
1692
1692
def findFunctionType (using Context ): Type = dealias match
1693
- case tp : AndOrType =>
1693
+ case tp : AndType =>
1694
1694
tp.tp1.findFunctionType & tp.tp2.findFunctionType
1695
+ case tp : OrType =>
1696
+ val tf1 = tp.tp1.findFunctionType
1697
+ val tf2 = tp.tp2.findFunctionType
1698
+ if ! tf1.exists then tf2
1699
+ else if ! tf2.exists then tf1
1700
+ else NoType
1695
1701
case t if defn.isNonRefinedFunction(t) =>
1696
1702
t
1697
1703
case t @ SAMType (_) =>
1698
1704
t
1699
1705
case _ =>
1700
- defn. AnyType
1706
+ NoType
1701
1707
1702
1708
/** This type seen as a TypeBounds */
1703
1709
final def bounds (using Context ): TypeBounds = this match {
Original file line number Diff line number Diff line change
1
+ type C = (() => Int ) | (() => String )
2
+
3
+ def foo (c : C ): Unit = ()
4
+
5
+ val _ = foo(() => 1 )
You can’t perform that action at this time.
0 commit comments