<commit_before>---
layout: doc-page
title: "Changes in Implicit Resolution"
---

Implicit resolution uses a new algorithm which caches implicit results
more aggressively for performance. There are also some changes that
affect implicits on the language level.

 1. Types of implicit values and result types of implicit methods
    must be explicitly declared. Excepted are only values in local blocks
    where the type may still be inferred:

        class C {

          val ctx: Context = ...        // ok

          /*!*/ implicit val x = ...    // error: type must be given explicitly

          /*!*/ next(): Context = ...   // error: type must be given explicitly

          val y = {
            implicit val ctx = this.ctx // ok
            ...
          }
<commit_msg>Fix docs for declaring implicit defs types<commit_after>---
layout: doc-page
title: "Changes in Implicit Resolution"
---

Implicit resolution uses a new algorithm which caches implicit results
more aggressively for performance. There are also some changes that
affect implicits on the language level.

 1. Types of implicit values and result types of implicit methods
    must be explicitly declared. Excepted are only values in local blocks
    where the type may still be inferred:

        class C {

          val ctx: Context = ...        // ok

          /*!*/ implicit val x = ...    // error: type must be given explicitly

          /*!*/ implicit def y = ...    // error: type must be given explicitly

          val y = {
            implicit val ctx = this.ctx // ok
            ...
          }

{'fraction_non_alphanumeric': 0.07886435331230283, 'fraction_numerical': 0.0012618296529968455, 'mean_word_length': 2.020952380952381, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4549091', 'n_tokens_mistral': 386, 'n_tokens_neox': 363, 'n_words': 193}