File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -1690,14 +1690,20 @@ object Types {
16901690 * is returned. If no function type is found, Any is returned.
16911691 */
16921692 def findFunctionType (using Context ): Type = dealias match
1693- case tp : AndOrType =>
1693+ case tp : AndType =>
16941694 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
16951701 case t if defn.isNonRefinedFunction(t) =>
16961702 t
16971703 case t @ SAMType (_) =>
16981704 t
16991705 case _ =>
1700- defn. AnyType
1706+ NoType
17011707
17021708 /** This type seen as a TypeBounds */
17031709 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